This is a migrated thread and some comments may be shown as answers.

how can I stop refreshing radnotifcation with no messages

2 Answers 53 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Tony asked on 19 Jun 2018, 06:21 PM

this is client side code:


  function OnClientUpdated(sender, args) {
  var message = "Update (check) was done!";
  var newMsgs = sender.get_value();
  if (newMsgs != 0) {;
  message += (newMsgs == 1) ? (" There is 1 new message!") : (" There are " + newMsgs + " new messages!");
  else {




    <telerik:RadNotification ID="ClientNotification" Visible="true" runat="server" RenderMode="Lightweight" EnableRoundedCorners="false" EnableShadow="true" 
                                Width="100%" Height="90" VisibleOnPageLoad="false"
                                Animation="Slide" AnimationDuration="500" VisibleTitlebar="false" ShowTitleMenu="false" KeepOnMouseOver="true"
                                Position="BottomCenter" AutoCloseDelay="4000" LoadContentOn="TimeInterval" UpdateInterval="12000" Skin="Telerik"
                                OnClientUpdated="OnClientUpdated" OnClientUpdating="OnClientUpdating" OnCallbackUpdate="OnCallbackUpdateClient">
                       <%--         <NotificationMenu>
                                    <telerik:RadMenuItem Text="Classic" Value="Classic" />
                                    <telerik:RadMenuItem Text="Business" Value="Business" />
                               <asp:image ID="notifyIconClient" runat="server" />&nbsp;&nbsp;<asp:Literal ID="WriteMsgClient" EnableViewState="false" runat="server" />
                               <br />
              <asp:HyperLink ID="instantmsgLinkClient" EnableViewState="false" Text="Go to your TMN Members instant message page to view and respond to them now" runat="server" />
                               <br />
                               <br />


this is server side code:


Protected Sub OnCallbackUpdateClient(sender As Object, e As RadNotificationEventArgs)

        Dim getClientFirstName_Parameter As SqlParameter
        Dim NotifyClientIMCount_Parameter As SqlParameter
        Dim MyClientName As String = String.Empty
        Dim MsgCntClient As Integer
        Dim globalLog As LoginView = CType(Page.Master.FindControl("globalinmsge"), LoginView)
        Dim ClientNotify As RadNotification = CType(globalLog.FindControl("ClientNotification"), RadNotification)

        Using getClientFirstName_conn = New SqlConnection(ConnectionStrings("TMNall").ConnectionString)
            Using getClientFirstName_cmd = New SqlCommand("dbo.getTMNClientFristName", getClientFirstName_conn)

                getClientFirstName_cmd.CommandType = CommandType.StoredProcedure
                getClientFirstName_cmd.CommandTimeout = 0
                getClientFirstName_cmd.CommandText = "dbo.getTMNClientFristName"

                getClientFirstName_Parameter = getClientFirstName_cmd.CreateParameter()
                getClientFirstName_Parameter.ParameterName = "@username"
                getClientFirstName_Parameter.Direction = ParameterDirection.Input
                getClientFirstName_Parameter.SqlDbType = SqlDbType.NVarChar
                getClientFirstName_Parameter.Value = "badboy69" 'Membership.GetUser(Page.User.Identity.Name).ToString()



                Using getClientFirstName_Reader = getClientFirstName_cmd.ExecuteReader()

                    If getClientFirstName_Reader.Read() Then

                        MyClientName = getClientFirstName_Reader("TMNmem_FirstName").ToString()

                    End If

                End Using
            End Using
        End Using

        Using NotifyClientIMCount_conn = New SqlConnection(ConnectionStrings("TMNall").ConnectionString)
            Using NotifyClientIMCount_cmd = New SqlCommand("dbo.getClientNotifyIMmsgCnt", NotifyClientIMCount_conn)

                NotifyClientIMCount_cmd.CommandType = CommandType.StoredProcedure
                NotifyClientIMCount_cmd.CommandTimeout = 0
                NotifyClientIMCount_cmd.CommandText = "dbo.getClientNotifyIMmsgCnt"

                NotifyClientIMCount_Parameter = NotifyClientIMCount_cmd.CreateParameter()
                NotifyClientIMCount_Parameter.ParameterName = "@username"
                NotifyClientIMCount_Parameter.Direction = ParameterDirection.Input
                NotifyClientIMCount_Parameter.SqlDbType = SqlDbType.NVarChar
                NotifyClientIMCount_Parameter.Value = "badboy69" 'Membership.GetUser(Page.User.Identity.Name).ToString()



                Using NotifyClientIMCount_Reader = NotifyClientIMCount_cmd.ExecuteReader()

                    If NotifyClientIMCount_Reader.Read() Then
                        If CInt(NotifyClientIMCount_Reader("NotifyIMClientCnt").ToString()) <> 0 Then

                            MsgCntClient = CInt(NotifyClientIMCount_Reader("NotifyIMClientCnt").ToString())


                            MsgCntClient = 0

                        End If

                    End If

                End Using
            End Using
        End Using

        Dim clientmesg As Literal = CType(ClientNotify.ContentContainer.FindControl("WriteMsgClient"), Literal)
        Dim linkclient As HyperLink = CType(ClientNotify.ContentContainer.FindControl("instantmsgLinkClient"), HyperLink)
        Dim ClientImg As Image = CType(ClientNotify.ContentContainer.FindControl("notifyIconClient"), Image)

        clientmesg.Text = [String].Concat(New Object() {MyClientName.ToString(), " you have ", MsgCntClient, " new instant message(s)!"})
        linkclient.NavigateUrl = "~/Account/clientsMain"
        ClientNotify.Value = MsgCntClient.ToString()
        ClientImg.ImageUrl = "~/images/radlaerticon.jpg"

    End Sub



thanks guys

2 Answers, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 08 May 2019, 04:04 PM

Did you ever get this fixed.  Having a similar problem.  Once I get a true result and have the message displayed I don't want to display it again until another event happens where I can reset the timer so it starts again.



Telerik team
answered on 13 May 2019, 01:18 PM
Hi Shawn,

I have just answered your support ticket on the matter and will advise that we continue our conversation there. For convenience, I am pasting my answer here as well:

Basically, the RadNotification control supports two possible scenarios:
  • show and hide depending on the set timer value
  • or makes requests on a timer basis or when it is shown.

As the values of the Notification properties cannot be changed on a callback, you can disable the control by setting updateInterval to "0" in the OnClientUpdated handler, just before showing it (make sure that the AutoCloseDelay is set to value bigger than 0 if you want to hide the Notification when the updates stop). The LoadContentOn property have to be set to "TimeInterval" for this scenario.

Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Top achievements
Rank 2
Answers by
Top achievements
Rank 1
Telerik team
Share this question