Accessing a parent web form control from within a nested user control?

Accessing a parent web form control from within a nested user control?

Post by Roy » Thu, 10 Feb 2005 21:30:14


How is it done? BTW, I'm reposting this here, as the datagrid newsgroup
appears functionally comatose...

I have a nested datagrid setup. When one updates the child grid using
edit, it also updates a field in the parent grid (the parent grid
update is done using a simple select query inside the child grid's
update sub). All is well, *however* after the update occurs the parent
grid is still displaying the old data even though the update has
occured. I was under the assumption that when I did a .databind() on
the child grid, the parent grid automatically reloaded? Well, evidently
it doesn't. :-/ In order to see the right data in the parent grid, I
have to leave the page then come back.

What do I do to get the parent grid to display the current data after
updating the child grid? I've tried many differents ways of getting
access to the parent grid from within the child grid's update sub, but
all have met with failure. Help!
 
 
 

Accessing a parent web form control from within a nested user control?

Post by Scott Alle » Sat, 12 Feb 2005 04:09:55

Every web control contains a property by the name of Parent - that's
one way. You might consider an alternative approach: raise an event.
Then the parent data grid can subscribe to the event and react if need
be, otherwise you'll have a tighter coupling between the two grids.