弹出消息框

本文介绍了一种结合Popupwin和Ajax实现页面局部刷新的方法。通过使用UpdatePanel和定时器组件,实现了页面上特定部分的异步更新。同时,通过C#代码控制Popupwin的显示与隐藏,展示了如何在实际项目中运用这些技术。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

Popupwin+Ajax异步刷新

先在页面注册该控件

<%@ Register Assembly="EeekSoft.Web.PopupWin" Namespace="EeekSoft.Web" TagPrefix="cc1" %>

在页面加入2个updatapanel 和1个scriptmanager

                    <asp:ScriptManager ID="ScriptManager1" runat="server" />
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                            <font color="red">当前消息数:</font><asp:Label ID="lbshow" runat="server" ForeColor="red"></asp:Label>
                                <cc1:PopupWin ID="pw" runat="server" ColorStyle="red" Title="欢迎您登陆管理页面" DragDrop="False"
                                    Height="109px" Width="158px" AutoShow="true" ActionType="RaiseEvents" Visible="false"
                                    DockMode="BottomRight"></cc1:PopupWin>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="30000" Enabled="true">
                                </asp:Timer>
                            </ContentTemplate>
                        </asp:UpdatePanel>

 

接下来就需要通过C#来控制popupwin 了

try
                {
                    T1.Enabled = false;

                    popupw.Visible = true;
                    popupw.HideAfter = -1;
                    popupw.AutoShow = true;
                    string msg = "";

                     msg += "<a href=/"Inspector_Monitor//ReportDetail.aspx?id=1 "/" target=/"mainFrame/">" </a><br />";
                    
                    popupw.Message = msg;
                    popupw.Title = "有新的消息";
                    popupw.ColorStyle = EeekSoft.Web.PopupColorStyle.Red;
                    popupw.DockMode = EeekSoft.Web.PopupDocking.BottomRight;
                    pw.Visible = true;
                    popupw.WindowScroll = true;
                    popupw.Visible = true;
                    Session["CurTime"] = DateTime.Now.ToString();
                }
                finally
                {
                    T1.Enabled = true;
                }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值