开发者

Re-usable ModalPopupExtender

I am trying to create a ModalPopupExtender th开发者_C百科at can be stored in a master page, or user control and allow me to pass a panel and an event to it, and use this panel as the panel to be "popped" and the event as the event called when the ok button is pressed.

I've been trying for some time now, with with a number of different methods, but none have worked correctly and the all seem like they're not quite the right way to do it. These include:

  • Adding the panel as a child control of another panel that is the Popuptarget of the extender. This does pop the right panel, but because the controls in the panel have been moved out of the childpage, they cannot be accessed in the event.
  • Changing the Popuptarget of the extender to be the panel I want to pop, then added a dynamicaly created button with the correct event as the ok button. This again pops the right panel, and calls the right event, but the event is unable to access the controls on the panel again.

So, if anyone can suggest the best way to do this, or any articles where it has been done before, that would be appreciated. The reason I am doing this is that some of the pages we have have upward of 20 different items that may need showing to the user with a modalpopupextender, adding an extender for each of these would be very tiresome.


This is something I had to do couple of years ago, I used the method on ASP.Net forum:

http://forums.asp.net/p/1301694/2541024.aspx

I put a JavaScript function on the masterpage that took in the Panel ID that I wanted to popup, but everything was handled by the panels themselves, no needing to pass events or anything around.

The most I had was two different popup's, no where near your 20.

Changing the Popuptarget of the extender to be the panel I want to pop, then added a dynamicaly created button with the correct event as the ok button. This again pops the right panel, and calls the right event, but the event is unable to access the controls on the panel again.

Could you explain this a bit more please? Why not have 1 button per panel you are poping up? You have 20 different panels and only 1 of those is active depending on the users request? Or do you need to cycle through different panels?

Could you put some sample code up to show what you're trying to achieve.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜