多个目标 ID 和 ModalPopUp 扩展器
晚上大家。
好的,我们开始吧!
是的,我的页面上有以下按钮,我希望使用一个模式弹出窗口来进行两次保存点击。因此,我对按钮有以下内容:
<asp:Button ID="btnSave1" runat="server" OnClick="btnSave1_Click" Text="Save" OnClientClick="$find('showSaveConfirm').show(); return false;" />
<asp:Button ID="btnSave2" runat="server" OnClick="btnSave2_Click" Text="Save" OnClientClick="$find('showSaveConfirm').show(); return false;"/>
<asp:Button ID="btnSaveAll" runat="server" Text="" Style="display: none" />
下面是我的模态面板信息:
<asp:Panel ID="pnlSaveConfirm" runat="server" Style="display: none;" CssClass="modalPopupContainer">
<div id="Div7" class="modalPopupHeaderPanel">
<div id="Div8" class="modalPopupHeader">
</div>
<asp:LinkButton ID="LinkButton2" runat="server" CssClass="modalPopupClose" CausesValidation="False">Cancel and close</asp:LinkButton>
</div>
<div id="Div9" class="modalPopupBannerPanel">
<div class="modalPopupPanel">
<br />
You are about to save this piece of data.
<asp:Button ID="btnOkSave" runat="server" Text="Ok" />
<asp:Button ID="btnCancelSave" runat="server" Text="Cancel" />
<br />
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="mdlPopupSaveConfirm" runat="server" TargetControlID="btnSaveAll" BehaviorID="showSaveConfirm"
OkControlID="btnOkSave" CancelControlID="btnCancelSave" PopupControlID="pnlSaveConfirm" BackgroundCssClass="modalBackground" />
现在,两次单击都会触发一个恰到好处的模态面板。取消了,取消了,但是有一个问题。
当我单击 btnOkSave 时,这似乎并未得到确认,因为 btnSave1_Click 和 btnSave2_Click 服务器端事件不会被触发。
有什么想法我做错了什么吗?
Evening all.
Ok, here we go!
Right I have the following buttons on my page and I wish to use one modal popup for both save clicks. I therefore have the following for the buttons:
<asp:Button ID="btnSave1" runat="server" OnClick="btnSave1_Click" Text="Save" OnClientClick="$find('showSaveConfirm').show(); return false;" />
<asp:Button ID="btnSave2" runat="server" OnClick="btnSave2_Click" Text="Save" OnClientClick="$find('showSaveConfirm').show(); return false;"/>
<asp:Button ID="btnSaveAll" runat="server" Text="" Style="display: none" />
And this below is my Modal panel info:
<asp:Panel ID="pnlSaveConfirm" runat="server" Style="display: none;" CssClass="modalPopupContainer">
<div id="Div7" class="modalPopupHeaderPanel">
<div id="Div8" class="modalPopupHeader">
</div>
<asp:LinkButton ID="LinkButton2" runat="server" CssClass="modalPopupClose" CausesValidation="False">Cancel and close</asp:LinkButton>
</div>
<div id="Div9" class="modalPopupBannerPanel">
<div class="modalPopupPanel">
<br />
You are about to save this piece of data.
<asp:Button ID="btnOkSave" runat="server" Text="Ok" />
<asp:Button ID="btnCancelSave" runat="server" Text="Cancel" />
<br />
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="mdlPopupSaveConfirm" runat="server" TargetControlID="btnSaveAll" BehaviorID="showSaveConfirm"
OkControlID="btnOkSave" CancelControlID="btnCancelSave" PopupControlID="pnlSaveConfirm" BackgroundCssClass="modalBackground" />
Now both clicks fire off the one modal panel which is spot on. The cancels, cancel but there is one problem.
When I click on the btnOkSave, this does not appear to be confirming as the btnSave1_Click and btnSave2_Click server side events do not get fired off.
Any ideas what I have done wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实上,我走了一条稍微不同的路线,因为我使用的是 Ajax 工具包,所以我实现了 ConfirmButtonExtender 的使用。
对于两个原始保存,我设置了两个指向同一面板的单独的 ModalPopUpExtender,它们由ConfirmButton Extender 执行:
将它们附加到实际面板:
这已经实现了我想要做的事情。
仍然很脏,但它有效:)
Well I actually went down a slightly different route and seeing as I was using the Ajax toolkit, I implemented the use of the ConfirmButtonExtender.
For the two original saves, I set up two seperate ModalPopUpExtenders pointing at the same panel, these being executed by the ConfirmButton Extender:
With these attached to the actual panel:
And that has achieved exactly what I am looking to do.
Still dirty but it works : )
btnOkSave 没有 OnClick 事件。将其添加到您的控件中:
There is no OnClick event for btnOkSave. Add this to your control: