Programmatic Creation

2 posts, 0 answers
  1. Craig Walker
    Craig Walker avatar
    6 posts
    Member since:
    Oct 2003

    Posted 02 Oct 2011 Link to this post

    I'd like to dynamically create stacked notifications in codebehind. I tried programmatically creating an instance of RadNotifcation using something like:
    Dim RadNotification1 As RadNotification = New RadNotification
    RadNotification1.EnableShadow = True
    RadNotification1.EnableRoundedCorners = True
    RadNotification1.ShowTitleMenu = False
    RadNotification1.Text = "You have new messages!<br>date: " & DateTime.Now.ToShortTimeString & "<br><br>"
    RadNotification1.Show()

    When it fires, though, a generic object error is thrown. Is it possible to programmically or dynamically create notifications?

    What I'm trying to do is retreive notification text from a database. But I want to display multiple notifications until the user closes the notification window.
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 04 Oct 2011 Link to this post

    Hi Craig,

    What I do not see in your code is where you add the RadNotification control to the page, for example:
    form1.Controls.Add(RadNotification1)

    This is required for any ASP control you create dynamically and it has to happen before you call its Show() method.

    Kind regards,
    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
Back to Top