RadNotification sometimes works and sometimes not

6 posts, 0 answers
  1. John
    John avatar
    44 posts
    Member since:
    Apr 2011

    Posted 17 Feb 2012 Link to this post

    I have a common function on the server that generates notification messages with RadNotification.  Some of them work correctly, and some of them do not work.  The ones that do not work show nothing - ever.  The notifications are all on the same page, all call the same function to generate the notification, and do not throw an exception afterwards.

    Any ideas on why this might be occurring?

    private void Notify(string strTitle, bool bsent = true)
    {
        if (DevicesRadGrid.SelectedItems.Count > 1)
        {
            if (bsent)
                NotificationText.Text = String.Format("sent {0}", DevicesRadGrid.SelectedItems.Count);
            else
                NotificationText.Text = "fail"
        }
        else
        {
            if (bsent)
            {
                GridDataItem gdi = (GridDataItem)DevicesRadGrid.SelectedItems[0];
                NotificationText.Text = String.Format("sent to {0}, gdi["Client"].Text);
            }
            else
                NotificationText.Text = "fail";
        }
     
        NotificationWindow.Title = strTitle;
        NotificationWindow.Visible = true;
        NotificationWindow.VisibleOnPageLoad = true;
        NotificationWindow.VisibleTitlebar = true;
        NotificationWindow.TitleIcon = ResolveUrl("~/Images/status/statusInfo.png");
    }
    <telerik:RadNotification ID="NotificationWindow" VisibleOnPageLoad="false" Visible="false"
        Position="TopCenter" KeepOnMouseOver="true" runat="server" ShowCloseButton="true" AutoCloseDelay="5000"
        TitleIcon="~/Images/status/statusInfo.png" Width="300px">
        <NotificationMenu Visible="false"></NotificationMenu>
        <ContentTemplate>
            <asp:Label runat="server" Text="This is some display text" ID="NotificationText"></asp:Label>
        </ContentTemplate>
    </telerik:RadNotification>
    The RadNotification is just inside the outermost div of the control.
  2. John
    John avatar
    44 posts
    Member since:
    Apr 2011

    Posted 17 Feb 2012 Link to this post

    I have done some tracing, and RadNotification.RenderContents is being called, and the data looks correct here.  It is still not showing on the screen though.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bill
    Bill avatar
    13 posts
    Member since:
    May 2011

    Posted 17 Feb 2012 Link to this post

    John,

    You may have to explicitly call the Show() method...

    RadNotificationWindow.show();
  5. John
    John avatar
    44 posts
    Member since:
    Apr 2011

    Posted 18 Feb 2012 Link to this post

    I have changed the bottom of the function to be:

    }
    NotificationWindow.Title = strTitle;
    NotificationWindow.VisibleTitlebar = true;
    NotificationWindow.TitleIcon = ResolveUrl("~/Images/status/statusInfo.png");
    NotificationWindow.Show();

     

    It still does not work.

  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 20 Feb 2012 Link to this post

    Hello John,

    When the ContentTemplate of the RadNotification is used it overrides the Text that you set in it, so if you want to set a simple string I suggest you remove the ContenTemplate. A suggestion on easily using it is available at the end of this reply, but please read the rest as well.

    Are you using AJAX to update the notification? If so - is the RadNotification actually included in the update panel so that the properties you change can take effect? If not - you should make sure it is by modifying your AJAX settings accordingly or rethinking the logic of the page.

    The case where the notification is not updated will not show it on the page because of the Visible=false property. You can try removing it and see how it goes.

    Nevertheless, when Show() is called it will show the notification even it is not updated in the AJAX if you remove this property, it will simply hold the old content. Since this does not happen the most likely explanation is that there is a JavaScript error on the page that prevents the notification's scripts from executing. Please examine your browser's console and try to resolve it first.

    You may also be interested in the new functionality we added with the Q1 2012 release - an overloaded server Show() method  that takes a string that will be displayed once in the RadNotification. If you do not need to change other properties (like icons, dimensions, etc.) I believe you will find it the easiest approach to show information to the user, as it does not require that the RadNotication is included in the AJAX response. You can see it in this online demo. Please examine the information carefully for more details on how this works - when is content update and when not and how to utilizie it - since you call one global method you can simply set the required properties in the notification's markup.


    Regards,
    Marin
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  7. John
    John avatar
    44 posts
    Member since:
    Apr 2011

    Posted 21 Feb 2012 Link to this post

    Adding the controls that might update the notification control to the Ajax manager and specifiying that they modified the notification control and adding the notification control to an update panel seems to have fixed the problem.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017