A prompt box is displayed in the lower right corner of asp.net.
The new information reminder feature is used in the development of information systems in asp.net, whether OA or other business systems. I would like to share with you the solution. Let's take a look at the figure above:
Advantages: 1) the style of the pop-up prompt box of the new message is quite good, I think.
2) the information content, number of reminders, and click link pages in the pop-up box are encapsulated in PopMessage. js, and you do not need to modify them.
3) easy to use. You only need to modify PopMessageHandler. ashx according to your needs and obtain the data you need to remind.
4) page reference is simple and easy to understand.
The following describes the implementation process:
1. Add the Common folder in the root directory of your Web project, which includes pictures, js scripts and general processing functions, please click to download: http://download.csdn.net/detail/taomanman/8338479
The directory structure is as follows:
2. Modify the PopMessageHandler. ashx file as needed. The code is listed and you need to modify it according to your actual business logic:
<% @ WebHandler Language = "C #" Class = "PopMessageHandler" %> using System; using System. data; using System. text; using System. web; using System. web. sessionState; using System. web. script. serialization; public class PopMessageHandler: IHttpHandler, IRequiresSessionState {////// The total number of to-do tasks ///Int totalTaskCount = 0; public void ProcessRequest (HttpContext context) {try {context. response. contentType = "text/plain"; // obtain task data string strSQL = "select * from v_getTipsCount"; DataSet ds = SqlHelper. executeDataSet (SqlHelper. localSqlServer, strSQL); if (ds! = Null) {if (ds. tables [0]. rows. count> 0) {DataTable dt = ds. tables [0]; int count1 = int. parse (dt. rows [0] ["count1"]. toString (); int count2 = int. parse (dt. rows [0] ["count2"]. toString (); int count3 = int. parse (dt. rows [0] ["count3"]. toString (); int count4 = int. parse (dt. rows [0] ["count4"]. toString (); int count5 = int. parse (dt. rows [0] ["count5"]. toString (); totalTaskCount = count1 + count2 + count3 + count4 + count5; if (totalTaskCount> 0) {var testData = new object [] {new {description = "new MEMBER count reminder-new member count reminder-service fee increase reminder-expired unpaid member count reminder ", count = count1.ToString () + "-" + count2.ToString () + "-" + count3.ToString () + "-" + count4.ToString () + "-" + count5.ToString (), href = "PersonnelManagement/PersonnelList. aspx "+"-"+" PersonnelManagement/PersonnelList. aspx "+"-"+" PersonnelManagement/inclucepersonnellist. aspx "+"-"+" PersonnelManagement/PersonnelFeeList. aspx "+"-"+" FinancialManagement/FinanceRecord. aspx "},}; JavaScriptSerializer jsonSerializer = new JavaScriptSerializer (); // execute the serialization context. response. write (jsonSerializer. serialize (testData) ;}}} catch (Exception e) {}} public bool IsReusable {get {return false ;}}}
3. Add js references, html elements, and js functions to the home page of your system, as shown in the following figure. Of course, jquery. js also needs to be added. Do not write the following code. Be sure to add them:
<Script src = "Common/PopMessage. js "type =" text/javascript "> </script> <script language =" JavaScript "type =" text/javascript "> // the pop-up message notification box var pop; function popMessage () {pop = new PopMessage (); // when there is a reminder, it appears every 15 seconds. If there is no message to be reminded, no pop will appear in the reminder box. show (15000, "mainIframe") ;}$ (function () {// execute the pop-up box popMessage () ;}) when the page is initially loaded; </script>
Iframe is used as the page container in the webpage, as follows:
<iframe id="mainIframe" name="mainIframe" height="100%" width="100%" src=http://www.baidu.com frameborder="0"></iframe>
4. The effect after completion is as follows:
Click the blue part to directly jump to the page to be processed.
The CSDN blog is currently running. please vote for it! ==== Click like