Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

not sure I understand you entirely, so I will be brief.

you want to add data to a specific row in a data grid? (i.e. multiple lines of data)

 

If so, there are a number of ways to do this. you could have two datagrids that are linked by an event i.e.CurrentCellChanged (update the other datagrids dataset, and control them seperatly). Or, you could add another table to your data set, that your current datagrid is bound to. Then, setup a relationship between the two tables (parent > child). You can then drill into a specific row and add detail to the new table in your dataset. ???? not sure if that helps.

Posted

no!

i want add new row of my current datagrid and set itchild of specific row :(

did you see any datagrid with some plus icon near of rows that when you click on them, you can see its child rows?

that row number 2 have 3 child rows.

 

if you can think that this is a datagrid view:

[b]  Code   Name      ParentID[/b]
[color=YellowGreen]  +1       name1     0[/color]
[color=Green]  -2       name2     0
     4     name4     2
     5     name5     2
     6     name6     2[/color]
[color=YellowGreen]  +3       name3     0[/color]
[color=Green]  +7       name7     0
[/color]

:confused:

[ once4ever ]
Posted

Sounds like you are talking about a recursive relationship. The only way I know of to get close to that, is similar to what I've already described (if you have only got two levels).

 

Have two identical tables(Elements) in your dataset, then set up a relationship between the two. i.e. TableB link ParentID field to TableA Code field. Then when you load the data for TableA put in the Where clause ParentID = 0, and for TableB ParentID<>0.

 

This should allow a drill down on your Datagrid to each of your top level codes and add data (even ones that don't currently have any child records). But, it is fairly static structure. If you intend to drill down further you will have to add extra tables(elements) to your dataset which may get a bit messy.

 

However, I've seen you can set up a internal relationship in your dataset between two fields in your table (element), i.e. ParentID and Code. so, if that works it theoretically should give you infinite levels. I�m fairly new to .NET and this isn't a problem i've tackled yet but hope it helps... :)

Posted
I think you might be confusing people with your description. You keeping talking about a datagrid, but if I'm understanding you correctly then what you are after isn't supported in a standard datagrid (as far as I know). It sounds to me like what your after is a hybrid of a datagrid and a treeview (thus allowing child nodes, as well as multiple columns). Perhaps one of the standard controls can achieve this, but if they can I've never come across it.
Anybody looking for a graduate programmer (Midlands, England)?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...