如何运用Asp.net的Ajax的Timer控件弹出提示框
页面代码<asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager><asp:Time...
页面代码
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Timer ID="Timer1" Interval="1000" runat="server" ontick="Timer1_Tick"></asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label2" runat="server"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
后台代码
protected void Timer1_Tick(object sender, EventArgs e)
{
if(Isreadid==true)
{
this.Label2.Text = "<script>MsgLoginPop(" + dr["E_UserName"].ToString() + ");</script>";
}
}
脚本代码
function MsgLoginPop(name)
{
var msg = new MessShow("Information",200,120,"温馨信息提示","<font color=#000><b>会员"+name+"登录了!</b></font>","","",'');
msg.show();
}
为什么后台代码中条件为真,它还是没在页面上显示提示框呢???? 展开
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Timer ID="Timer1" Interval="1000" runat="server" ontick="Timer1_Tick"></asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label2" runat="server"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
后台代码
protected void Timer1_Tick(object sender, EventArgs e)
{
if(Isreadid==true)
{
this.Label2.Text = "<script>MsgLoginPop(" + dr["E_UserName"].ToString() + ");</script>";
}
}
脚本代码
function MsgLoginPop(name)
{
var msg = new MessShow("Information",200,120,"温馨信息提示","<font color=#000><b>会员"+name+"登录了!</b></font>","","",'');
msg.show();
}
为什么后台代码中条件为真,它还是没在页面上显示提示框呢???? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询