开发者

How to make 5 links to open the same modal popup?

开发者 https://www.devze.com 2022-12-24 18:44 出处:网络
I have 5 links that are on the same form but I would like them all to reference the same AJAX modal popup extender. I am basically showing a panel with the same view layout with just different data de

I have 5 links that are on the same form but I would like them all to reference the same AJAX modal popup extender. I am basically showing a panel with the same view layout with just different data depending on which link is pressed, showing different match scores from games.

The only way I can get it to work is have 5开发者_JS百科 panels with unique names where each link references its own panel.

Can I make all the links call the same panel?

Thanks.


If you are willing to incur a hit on postback then you can create an empty linkbutton and use that as the target of your modal popup. Then in your code behind call it's modalpopup.show method along with the code to put what you want into the popup.

<asp:Button runat="server" ID="HiddenControl" Style="display: none" />
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
PopupControlID="Panel1"   TargetControlID="HiddenControl" />

<asp:Button runat="server" ID="VisibleControl" text=”click me” />
<asp:LinkButton runat="server" ID="visibleControl2">click me again</asp:linkbutton>

Simply fire this off on either the VisibleControl.click or visibleControl2.click events.

ModalPopupExtender1.show()
0

精彩评论

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