Today we had a problem with an popup extension. This was caused by storing the control in a session and use it for later. We have to make sure that
Sessions are only used to store data, not full ASP.NET controls.
So when you see something like the followin in your code:
Session["Popup"] = popupControl;
popupControl = Session["Popup"];
popupControl.Show()
There is a chance that after a postback from the client, the popup is unable to show.
The solution was to recursively find the popup control by looking in all parent controls:
private T FindParentControl( T control )
where T : class
{
if( control.Parent is T )
{
return control.Parent as T;
}
return control.Parent != null ? FindParentControl( control.Parent ) : null;
}
This is also posted at stack overflow:
http://stackoverflow.com/questions/4343144/ajaxcontroltoolkitmodalpopupextender-not-working-at-second-attempt/7658857#7658857
No comments:
Post a Comment