Can't set notification properties on master notification?

3 posts, 1 answers
  1. Eddie
    Eddie avatar
    66 posts
    Member since:
    May 2008

    Posted 15 May 2012 Link to this post

    I'm using a RadNotification in a UserControl, which is in a content page, which is in a master page.  The RadNotification the UserControl is referencing is in the Master page.  Here's the code I use to get it:
    public RadNotification GetNotificationAlert(Control ctl)
    {
        var master = (defaultMaster)ctl.Page.Master;
        if (master != null)
            return master.FindControl("RadNotification1") as RadNotification;
     
        return null;
    }

    This works, but if I try to change any of the properties of the notification, such as width, visibletitlebar, etc. nonw of them work.  Here's an example:
    var notification = GetNotificationAlert(this);
    notification.VisibleTitlebar = false;
    notification.Width = 540;
    notification.Height = 90;
    notification.Opacity = 70;

    Any idea what I might be doing wrong?

    Thanks!

  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 17 May 2012 Link to this post

    Hi Eddie,

    In what event are you calling this code? Is it executed during an AJAX request that does not involve the RadNotification? This can be the case if, for example, your entire user control is wrapped in an update panel/ajax setting from the parent page. You can confirm if this is the case by examining the network requests and responses, e.g. via Firebug. What can be done in this case - wrap the notification in an update panel so that it will be disposed and updated on the client. If this panel's UpdateMode is set to Conditional you will need to also call its Update() method each time you modify the notification. If it is set to Always (the default) keep in mind that each AJAX request will dispose this notification which may not be desired.


    Greetings,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eddie
    Eddie avatar
    66 posts
    Member since:
    May 2008

    Posted 18 May 2012 Link to this post

    I wrapped the Notification in an update panel and set the updatemode to conditional, and that causes the notification to update each time it is called, which fixes my issue.  Thanks!
Back to Top