我正在使用Modalpopupextender
ajax控件来弹出面板。在面板上有两个按钮,
一个是Asp按钮(btnOk),一个是普通的html按钮(btnCancel)。单击OK
弹出式面板关闭,但我不想在单击Ok
按钮时关闭弹出式面板,只有在单击cancel
按钮时才会关闭弹出窗口。如何停止Ok
按钮关闭弹出面板。请找到下面的代码段
<ATK:ModalPopupExtender
BackgroundCssClass="ModalPopupBG"
DropShadow="true"
OkControlID="btnOkay"
CancelControlID="btnCancel"
runat="server"
PopupControlID="AddTopic"
id="ModalPopupExtender1"
OnOkScript="onOk()"
TargetControlID="btnAddNew"/>
<asp:Panel ID="AddTopic" runat="server" CssClass="popup_Container" >
<div class="popup_Titlebar" id="PopupHeader">
<div class="TitlebarLeft">
Add New Topic
</div>
<div class="TitlebarRight" onclick="cancel();">
</div>
</div>
<div class="popup_Body">
<asp:Label ID="lblTopic" runat="server" Text="Topic Name"> </asp:Label>
<asp:TextBox ID="tbTopicName" runat="server" Width="400px" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="*" ControlToValidate="tbTopicName">
</asp:RequiredFieldValidator>
<br /> <br />
<span style="padding-left:350px">
<asp:Button ID="btnDone" runat="server" Text="Done" onclick="btnDone_Click"
UseSubmitBehavior="False"/>
<input id="btnCancel" value="Cancel" type="button" OnClick="cancel();"/>
</span>
</div>
<div class="popup_Buttons" style="display: none">
<input id="btnOkay" value="Done" type="button" />
</div>
</asp:Panel>
答案 0 :(得分:4)
按照以下说明添加到btnDone_Click方法的末尾:ModalPopupExtender1.Show();
答案 1 :(得分:2)
从ModalPopupExtender中删除属性“OkControlID”。