Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
430
Add Child Rows to wingrid programatically which is filled with Datasource
posted

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

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    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.

Children