//Javascript function to show modalpopup
<script type="text/javascript" language="javascript">
function ShowModalErrors(ModalClientID) {
var modalPopUp = $find(ModalClientID);
if (modalPopUp != null) { modalPopUp.show(); }
return false;
}
</script>
//ASPX Page Controls
<asp:Panel ID="pnlPopUp" runat="server" Visible="false" CssClass="modalPopup">
<asp:UpdatePanel ID="updErrors" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="lblPopUp" CssClass="Label" runat="server" /><br /><br />
<asp:Button ID="btnOk" runat="server" Text="OK" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
<AJAXToolKit:ModalPopupExtender ID="mdlPopUpExt" BehaviorID="mdlPopUpExtID"
TargetControlID="lblInputErrors"
PopupControlID="pnlPopUp"
DropShadow="false"
BackgroundCssClass="modalBackground"
OkControlID="btnOk"
runat="server" />
<asp:Label ID="lblInputErrors" visible="false" runat="server" />
...
<asp:LinkButton ID="btnSave" Font-Underline="True" CssClass="LabelButton" Text="Save Pricing"
Runat="server" OnClick="btnSave_Click" ToolTip="Save Pricing" />
//ASPX Page Code Behind
protected void btnSave_Click(object sender, EventArgs e)
{
...
lblPopUp.Text = "Some Random text";
//TODO: Figure out why it can't find the modal popup extender id
ScriptManager.RegisterStartupScript(this, this.GetType(), "Data_Errors", "ShowModalErrors('" + mdlPopUpExt.BehaviorID + "');", true);
}
|