Tuesday, 16 September 2014

Modal Popup in ASP.NET using C#

Standard
Hi, today's topic is Modal popup using AJAX Modal Popup in ASP.NET using C#. Many times you have shown that, some message is showing by full masking the background(white/black). How to do that. Very easy to do.

Create a new project and add a new WebForm. Before proceeding add the extension of AJAX Control Toolkit (4.5, 4.0, 3.5).

In the tools section you will found Modal Popup Extender. Use this one to create popup.

Write down the following code to create a popup.

<form id="form1" runat="server">
<asp:scriptmanager id="ScriptManager1" runat="server">
 </asp:scriptmanager>
 <asp:button id="btnShow" runat="server" text="Show Modal Popup">
 <cc1:modalpopupextender backgroundcssclass="modalBackground" cancelcontrolid="btnClose" id="mp1" popupcontrolid="Panel1" runat="server" targetcontrolid="btnShow">
 </cc1:modalpopupextender>
 <asp:panel align="center" cssclass="modalPopup" id="Panel1" runat="server" style="display: none;">
  </asp:panel></asp:button><br>
<h1>
AJAX Modal Popup</h1>
Here is the content which you wan to show<br>
<asp:button id="btnClose" runat="server" text="Close"></asp:button>
</form>

PopupControlID : To visible the popup
CancelControl : To close the popup
TargetControl : To show div or panel in the popup


Run your project and test it with your first popup.

Output :



0 comments:

Post a Comment