当前位置: 代码迷 >> ASP.NET >> 问个Timer 有关问题
  详细解决方案

问个Timer 有关问题

热度:6269   发布时间:2013-02-25 00:00:00.0
问个Timer 问题
HTML code
<asp:ScriptManager ID="ScriptManager1" runat="server">        </asp:ScriptManager>    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" >           <ContentTemplate>               <asp:Timer ID="Timer1" runat="server" ontick="Timer1_Tick" Interval="5000" Enabled="true">           </asp:Timer>           </ContentTemplate>       </asp:UpdatePanel>            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">           <ContentTemplate>               <cc1:popupwin id="pw" runat="server"                 DragDrop="False" Height="109px"                    Width="175px" AutoShow="true"> </cc1:popupwin>           </ContentTemplate>             </asp:UpdatePanel> 

C# code
protected void Timer1_Tick(object sender, EventArgs e)    {        DataSet ds = AccessDAL.Books_hotel.Books_Tanchu(0, 0);        if (ds.Tables[0].Rows.Count > 0)        {            pw.Title = "通知";            pw.Message = "您好,当前您有留言信息未读。<a href=\"Books/books_list.aspx?page=31\" target=\"mainFrame\">点击进入</a>";            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.UpdatePanel1.GetType(), "msg", "pwespopup_winLoad();", true);             this.UpdatePanel1.Update();           }    }


C# code
protected void Page_Load(object sender, EventArgs e)    {        if (!Page.IsPostBack)        {        DataSet ds = AccessDAL.Books_hotel.Books_Tanchu(0, 0);        if (ds.Tables[0].Rows.Count > 0)        {            pw.Title = "通知";            pw.Message = "您好,当前您有留言信息未读。<a href=\"Books/books_list.aspx?page=31\" target=\"mainFrame\">点击进入</a>";        }        else {            pw.AutoShow = false;        }        }    }



是这样个情况,主要是想做不刷新弹出消息(前台留言,后台无无刷新提示)。
第一次进入后台如果没有留言的话,然后去前台留言,后台不弹出来消息。
但是刷新以后会弹出,把这条信息删除或者已读,在继续去前台留言的话后台就可以正常自动弹出(不退出后台)。
怎么回事,表达不清楚的话可以回帖问。

------解决方案--------------------------------------------------------
应该是你脚本注册那边出问题了吧,第一次留言后,查看网页源代码试试看有没有脚本
  相关解决方案