Asp.net instant pop-up message like MSN [reprint]

Source: Internet
Author: User

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 = "timereffectick" 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 + = "<
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;
}

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 = "timereffectick" 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 + = "<
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;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.