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
5739
Child band datasource grabbing entire database every time I expand the child
posted

Hi,

I've been having a really hard time with the WHDG performance.  I have a parent and child band which are being fed by two sqldatasources into one WebHierarchicalDataSource.  The query in the child's datasource is simply "select * from [jobparts]."  Every time I hit the expand button, that sqldatasource runs a "select * from [jobparts]" which returns thousands of records and then picks out the one or two rows it needs to display in the child band. (You can see that by watching the sqldatasource_selected event and checking the affectedrows property of e)

So I tried using manual load on demand to load the data in code in the rowisland_populating event when the expand button was hit.  Same problem, since the sqldatasource of the child is still connected to my webhierarchicaldatasource, it does the whole select process and THEN it populates the WHDG through my code.  So then I changed the query in the child's sqldatasource to something that doesn't return any records but that makes me lose the expand button on the parent band all together so I can never get into the rowisland_populating event at all.

Is there a way to set this up so that the child datasources only select what they need from the database?   I was thinking of setting up some crazy custom paging scheme for the chld band queries, but I don't have enough Tylenol in the office to start thinking about that.

Edit: I just figured out a possible way by using the WebHierarchicalDataGrid1_RowIslandDataBinding event and changing the selectcommand of the sqldatasource of the child there.  I have to make sure not to change it when the parent grid loads so that the expand buttons will be created. I'm not sure how to get the parent rows datakey in that event though.

 

Thanks, Ed

 

Parents Reply Children