Load Event on Nested Data Grid

jimmycheese

New Member
I have a DataGrid that contains a nested DataGrid inside of it. This gives me a MasterGrid / DetailGrid view of my data. I databind the DetailGrid using its Load event. This works great when the item first loads but when I click a page number on the MasterGrid, I get the following events:<BR>First the Load event fires on the DetailGrid - after inspecting this event, the MasterGrid (or sender.NabingContainer) is unbound. Then I get the PageIndexChanged event. That is where I bind some new data to my Master Grid and reset the CurrentPageIndex. Finally I get another Load event on my DetailGrid. Why would I get two Load events on my Detail grid?<BR><BR>Is this the proper way to nest datagrids? Any other ideas on how to build a Master / Detail relationship would help - I want to do Paging on the MasterGrid and sorting on the Detail grid. That is where the difficulty started.<BR><BR>I have a hack way of fixing the problem. I just don't databind the DetailsGrid if its load event tells me that the MasterGrid is currently not bound to any data. That seems like a HAck to me only because I cannot understand where the second Load event comes from.I tried to nest a datagrid within another once, too, and like you I got a bad result. I figured it couldn't be done. Please post if you get it to render. Wish I could help you.Since the purpose of this nested datagrid is for a Code Example and to help me learn C# and ASP.NET better - I will be sure to post the code when I am done!Hi David,<BR><BR>Here are some URLs on Master-Detail DataGrids to follow up:<BR><BR>http://www.devdays.com.ar/Info/Tecnologias/ASP/Creating%20a%20Master-Detail%20View%20Using%20the%20ASP+%20DataGrid%20Co ntrol.htm <BR><BR>http://www.c-sharpcorner.com/asp/Articles/MasterDetailDCHK.asp <BR><BR>http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=135 <BR><BR>http://www.aspalliance.com/aldotnet/examples/masterdetail_ddl_datagrid.aspx <BR><BR>Hope they help,<BR><BR>JONI have seen a few of those samples - but not all of them! I do, however, plan on allowing paging and sorting on both the master and the detail data-grids and that is where it gets real tricky! The second complexity I have is that I will be showing a Detail grid per-row in the master grid. I will certainly inspect the new samples you have given.<BR><BR>Thanks!
 
Back
Top