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