Hi All,
In my application i reached at stage where in one form in the wingrid i want to add child rows to the already added DataSource. Let me make it more clear.
In my grid i have loaded DataSource and displaying some records. Lets say the data is about a school and i am displaying the records of the Teachers of the school
So it displays something like this
ID FirstName LastName Phone Address SubjectsTaking
1 aaaa bbbb 1215 fsdfsdfsd 3
2 bbbb cccc 2548 sdfsdfsdf 2
and so on....Now what i what i want is that based on the LastColumn in which it displays how many subject one teacher takes on base of that i want to add child rows under that Row....Means Teacher1 is taking 3 subjects then i want to add 3 rows and display some data there.....Teacher2 is taking 2 subjects then under row number 2 i want to add 2 rows.
Main thing is that the data which i want to display in ChildRows are not in the database completely and that's why i can't create dataset with related tables and create hierarchical view....so if i get the idea how to achieve this i can create valuelists and bind then to the columns
Regards,
Carlton
Hi Carlton,
There's no such thing as an unbound row. For a row to exist in the grid, it must exist in the data source. So it seems to me that you will need to add a second table to your data set that contain the rows for the classes and that each row will have to be related to the teachers row via some key value and you will need to define a relationship in the DataSet to connect the two tables.
If you want to use the grid in a more sort've unbound way, then you could use the UltraDataSource component instead of a DataSet. The UltraDataSource allows you to manually add bands and rows to your data either at design-time or in code with no data base. Of course, this would mean you would need to handle getting the data from the data source and populating the UltraDataSource with that data, and then also handle the writing of the data back to the data base yourself.
Hi Mike,
Thanks for the quick reply. I got your point. now i was wondering that if i add another table in my database and set relationship between the two tables then the grid will automatically create child band and child rows but is it possible after that to add a column to the child band programtically????
Means once i add another table in dataset and load the grid the child band which will come which will be having columns in table 2 can i add any extra column in that child band?????such as a column with check box to select the row or something like that????