2.0 in the implementation of the window alarm tips

Source: Internet
Author: User

In the Web application, such as OA, often need to use some hints, such as email arrived, do a hint box like MSN, pop-up to the user prompts, and then close. In the Ajax of 2.0, this is not difficult to do now, just see a foreigner's article, explained to, the following summary of

For example, there is a database table, is stored email, when the database table in the email one time, prompts the user, first simple write a webservice as follows

public class InboxService : System.Web.Services.WebService
   public int GetLatestNumberOfEmails()
     int numberOfEmails = 0;
     using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings[0].ConnectionString))
       using (SqlCommand cmd = new SqlCommand("GetLatestNumberOfEmails", conn))
         cmd.CommandType = CommandType.StoredProcedure;
         numberOfEmails = (int)cmd.ExecuteScalar();
     return numberOfEmails;

Notice here to call Webserice on the client via Ajax, plus [ScriptService]

2 in Default.aspx, first add a UpdateProgress control, as follows

<asp:UpdateProgress DynamicLayout="False" ID="UpdateProgress1" runat="server">
     <div id="modal" class="modal">
       <div class="modalTop">
         <div class="modalTitle">My Inbox</div>
         <span style="CURSOR: hand" onclick="javascript:HidePopup();">
       <div class="modalBody">
         You received <strong><span id="modalBody"></span></strong>&nbsp; Email(s).

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: 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.