April 28, 2011

Ajax Modalpopup Extendar

Here is code below to show how to display ajax modalpopup extendar in your web page.

HTML Code

<asp:Button ID="btnShow" runat="server" Text="Show" CausesValidation="false" CssClass="defaultButton"
OnClick="btnShow_Click" />
<asp:HiddenField ID="ShowErrorAlert" runat="server" />
<asp:HiddenField ID="HideErrorAlert" runat="server" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" CancelControlID="HideErrorAlert"
TargetControlID="ShowErrorAlert" BackgroundCssClass="popupBackground" PopupControlID="pnlShowErrorAlert" />

<asp:Panel ID="pnlShowErrorAlert" runat="server" Style="display: none;">
<div class="title">
Error Window
</div>
<div class="popupWindow">
<asp:Label ID="lblErrorInfo" runat="server"></asp:Label><br />
<br />
</div>
</asp:Panel>
Button Click Code

protected void btnShow_Click(object sender, EventArgs e)
{
ModalPopupExtender1.Show();
}