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

RadNotification sometimes works and sometimes not

5 Answers 527 Views
Notification
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 17 Feb 2012, 07:36 PM
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.

5 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 17 Feb 2012, 08:48 PM
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.
0
Bill
Top achievements
Rank 1
answered on 17 Feb 2012, 10:34 PM
John,

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

RadNotificationWindow.show();
0
John
Top achievements
Rank 1
answered on 18 Feb 2012, 11:02 PM

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.

0
Marin Bratanov
Telerik team
answered on 20 Feb 2012, 05:20 PM
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 >>
0
John
Top achievements
Rank 1
answered on 21 Feb 2012, 02:35 PM
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.
Tags
Notification
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Bill
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or