如何动态显示警报消息(modalpopup) [英] How to I display alert messages dynamically (modalpopup)

查看:72
本文介绍了如何动态显示警报消息(modalpopup)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码背后:



Code behind:

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文件:





Aspx file:

<%@ 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>

推荐答案

1.为了激活模态弹出扩展器,你还必须使用JavaScript。



2.您可以查看我的下一篇文章,并提供源代码( ContactPage 子章节):

高级ASPX GridView分页和数据实体 [ ^ ]
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[^]


这篇关于如何动态显示警报消息(modalpopup)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆