单击“确认”后,“ btnSubmit_Click”不会在后面的代码中被调用。在OnClientClick上调用ClosePopup并返回true,该值应回发并在服务器端调用Submit。有什么想法为什么不起作用?
<ajaxToolkit:ModalPopupExtender ID="mpe" runat="server" TargetControlId="btnCopyShip"
PopupControlID="ModalPanel" BackgroundCssClass="ui-widget-overlay"
CancelControlID="btnCancel" behaviorid="modalwithinput"
OnCancelScript="ClearUI();"/>
<asp:Panel ID="ModalPanel" runat="server" style="background-color:White; width:320px; padding:0px 10px 10px 10px; border:1px Black; display: none;height:100px" cssClass="shadow">
<asp:UpdatePanel ID="uPnlNewShip" runat="server">
<ContentTemplate>
<fieldset style="width:300px;">
<legend style="font-weight:bold;font-size: medium">Copy Ship</legend>
<label for="lblShip" style="padding-left: 0px" >Ship: </label>
<asp:DropDownList runat="server" ID="ddlNewShips" style="width:150px">
</asp:DropDownList><%-- ValidationGroup="popup"--%>
<asp:RequiredFieldValidator ID="popupRequiredFieldValidator" runat="server"
ControlToValidate="ddlNewShips" Display="None"
ErrorMessage="Required Field" SetFocusOnError="True"
InitialValue="0">
</asp:RequiredFieldValidator> <%--ValidationGroup="popup"--%>
<%--<ajaxToolkit:ValidatorCalloutExtender runat="server"
targetcontrolid="popupRequiredFieldValidator"
id="popupValidatorCalloutExtender"
behaviorid="ddlValidator" enabled="True">
</ajaxToolkit:ValidatorCalloutExtender>--%>
</fieldset>
<br /><br />
<span style="float: right">
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" CausesValidation="False"/>
<asp:Button ID="btnSubmit" runat="server" Text="Confirm" OnClick="btnSubmit_Click" OnClientClick="return ClosePopup()"/>
</span>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
function ClosePopup()
{
if (IsValid())
{
ClearUI();
$find('modalwithinput').hide();
return true;
}
else
return false;
}