Please provide me the code for REMINDER in ASP.NET with C#

what do you mean reminder?

Something like outlook's calendar may be , but it does not matter , no one will write code for you here.

I use WebService to check new message(s).
I put WebService in ASPX form and use JavaScript to call it.

ASP.Net will check to database every 5 minutes for user who login to the program. If there is a new message, JavaScript will open new window to display the new message.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ OutputCache Location="Client" duration="5" varybyparam="none" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>.:BMI ERP:.</title> 
    <script type="text/javascript">         
    function CheckNewMessage()
    {
        objXML = new ActiveXObject("Microsoft.XMLDOM");
        objXML.async = false;
        var UserID= "<%= Session("UserID") %>";
        strSql = "MyWebService.asmx/GetTotalNewMessages?UserID=" + UserID;
        objXML.load(strSql);        
        var total;
        total = objXML.text;                 
        if(total>0) 
        {            
            var w = 0, h = 0;
            if (document.all || document.layers)
            { 
               w = screen.availWidth;
               h = screen.availHeight;
            }
            var popW = 550, popH = 350;
            var leftc = (w - popW) / 2, topc = (h - popH) / 2;
            window_bbs = window.open('Transactions/BBS/BrowseNewMessage.aspx','window_bbs','scrollbars=yes,left=' + leftc + ', top=' + topc + ',width=550,height=350');
            window_bbs.focus();
        }
        setTimeout("CheckNewMessage()",3000);        
        return true;  
    }
        
    </script>
</head>
<frameset rows="8%,*" framespacing="0" frameborder="0" border="0" onload="CheckNewMessage()">  
    <frame name="frmMenu" id="frmMenu" src="Menu.aspx" scrolling="no" />      
    <frame name="MyFrame" id="MyFrame" src="Home.aspx"/>
</frameset>
<body> 
</body>
</html>
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Web.HttpContext

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class MyWebService
    Inherits System.Web.Services.WebService

    <WebMethod()> Public Function GetTotalNewMessages(ByVal UserID As String) As Int16
        Dim CnBBS As New SqlClient.SqlConnection
        GetTotalNewMessages = 0
        If GetCN(CnBBS) Then
            Dim CmTotal As SqlClient.SqlCommand = CnBBS.CreateCommand
            CmTotal.CommandText = "SP_GetTotalNewMessages"
            CmTotal.CommandType = CommandType.StoredProcedure
            CmTotal.Parameters.Add(New SqlParameter("@UserID", SqlDbType.VarChar)).Value = UserID
            CmTotal.Parameters.Add(New SqlParameter("@Total", SqlDbType.TinyInt)).Direction = ParameterDirection.Output
            CmTotal.ExecuteNonQuery()
            GetTotalNewMessages = CInt(CmTotal.Parameters("@Total").Value)
            CnBBS = Nothing
            CmTotal = Nothing
        End If
    End Function
End Class

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.