Ok so this has been doing my head in for nearly 3 hours straight. Everytime I think I found a piece of code that could solve this problem, adapt it and try it... well I always get the same darn result.
Here's the structure
MasterPage
Page
TabContainer + TabPanel (AJAX)
UpdatePanel (in a tabpanel)
UserControl containing a second user control
I keep telling myself I may have gone crazy trying to work with such a structure, but i have to load a different part depending on the current page, but the base stays the same (so thats why I have imbricated usercontrols). I use LoadControl() at pageload to load the correct control.
Now on to the problem: The second user control (mainly consisting of a gridview, so I'll call it the grid control) disappears when I generate a postback from within itselft (like clicking on a link in the button column). If I generate a postback from the parent control, however, it works just fine. I tried a bunch of things, liek using the viewstate to reload the control, to no avail. I thought maybe it was my control structure that would be the problem, so I made a test user control with just a button called click. Same thing happens.
In debug, I realized that the gridcontrol's page_load event was never called when I generated a postback from itself. So i went radical and added an updatepanel around the page content. Seems to fix the issue, but I don't really want the events of that part of the page to be independant from the rest... Cuz some buttons on the parent user control are supposed to cause the data displayed in the gridcontrol to change. And unless I can set triggers from the parent control, which I don't really know how to do if it's possible, well it's not really useful.
I'd appreciate any input on this, I could post my code but I don't really think it'd be that useful, and I hope I've been clear anough.
Thanks for your time
Try registering programmatically the controls from your Grid Control to execute an async postback:
ScriptManager1.RegisterAsyncPostBackControl(control);
No comments:
Post a Comment