How to display data(with image) in gridview or treeview having parent child relationship in asp.net

598 views Asked by At

I am fetching data from database which is linked as following.

Root->Table 1
Each root can have 'n' number of parents -Table 2
Each parent can have 'n' number of children- Table 3
There is an image associated with each children saved in Table 4
which has image stored for each children in varbinary format.

All four tables are linked in via primary and foreign key relationship in sql server database

I have written a inner join query between all four tables which fetches me result as below. This is a sample data from database sql server

Root Id  Parent    Child      Image
   2      Parent1  Child    varbinary data
   2      Parent2  Child    varbinary data
   3      Parent1  Child    varbinary data
   3      Parent1  Child     varbinary data

I am using DataTable to fetch it and want to bind to a datasource such as grid view as shown below or depict in tree view fashion where each child when expanded should display the image on right side. /* dummy text The GridView control is the successor to the DataGrid and extends it in a number of ways. With this GridView control, you could display an entire collection of data, easily add sorting and paging, and perform inline editing. In addition to just displaying data, the GridView can be used to edit and delete the displayed data as well. The GridView comes with a pair of complementary view controls: DetailsView and FormView. By combining these controls, you can easily set up master-detail views using very little code and sometimes no code at all. From the following chapters you can see some important operations in ASP.NET GridView control. */ Can anyone please suggest me how should I go forward for this in asp.net. I don't have much knowledge on javascript so if possible any suggestion in asp.net controls will be a great help. Any help is highly appreciated. Thanks

0

There are 0 answers