Click here to Skip to main content
15,914,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Code behind:

C#
protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btn_Click(object sender, EventArgs e)
    {


            WarningModal.Show();
            lblWarning.Text = "This is a popup warning";

    }


Aspx file:

XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_webforms_BeforeLogin_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="rvc" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:Button ID="btn" runat="server" onclick="btn_Click" />

<rvc:ModalPopupExtender ID="WarningModal" runat="server"
TargetControlID="btn"

CancelControlID="btnWarning"
DropShadow="true"
PopupControlID="pnlIssues" >
</rvc:ModalPopupExtender>

<!-- Panel -->
<asp:Panel ID="pnlIssues" runat="server"
BorderColor="Black" BorderStyle="Outset"
BorderWidth="2" BackColor="Wheat" Width="500px"  Height="300px">
   <center>
       <h2 class="style2">
           Information</h2>
       <p>

          <asp:Label ID="lblWarning"
runat="server"> </asp:Label>
       </p>

 <!-- Label in the Panel to turn off the popup -->
 <asp:ImageButton ID="btnWarning" runat="server"
                ImageUrl="~/admin/images/1 (4).jpg"  Width="200px" Height="200px"/>
</center>

</asp:Panel>
    </div>
    </form>
</body>
</html>
Posted

1 solution

1.In order to activate modal popup extender you have to use also JavaScript.

2.You could have a look in my next article, and provide source code ( ContactPage sub-chapter):
Advanced ASPX GridView Pagination and Data Entities[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900