Recently, the company has to complete the function of popping up messages in real time. Find a third-party control popupwin on the Internet. The pop-up window of this control is the same as the pop-up window of msn friends, and the effect is quite good. You can use the timer control to obtain data in real time. A small window is displayed.
Popupwin + Ajax asynchronous refresh
Register the control on the page first
<% @ Register Assembly = "EeekSoft. Web. PopupWin" Namespace = "EeekSoft. Web" TagPrefix = "PC3" %>
Add two updatapanel and one scriptmanager to the page.
<Asp: ScriptManager ID = "ScriptManager1" runat = "server"/>
<Asp: UpdatePanel ID = "UpdatePanel1" runat = "server" UpdateMode = "Conditional">
<ContentTemplate>
<Font color = "red"> current Message count: </font> <asp: Label ID = "lbshow" runat = "server" ForeColor = "red"> </asp: label>
<PC3: PopupWin ID = "pw" runat = "server" ColorStyle = "red" Title = "welcome to the Management page" DragDrop = "False"
Height = "pixel PX" Width = "158px" AutoShow = "true" ActionType = "RaiseEvents" Visible = "false"
DockMode = "BottomRight"> </PC3: 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>
Next we need to use C # To control 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 = "New Message available ";
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;
}