Using notification for notes

2 posts, 0 answers
  1. FEST
    FEST avatar
    31 posts
    Member since:
    Jul 2011

    Posted 17 Oct 2011 Link to this post

    Hi forum.

    I'm trying to use the radnotification to be used as a note. In my page i have a radbutton and every time someone clicks it i want for a new radnotification to be created. I also would like to make it able for the user change the position of the radnotification by mouse using drag, I don't know if it is possible. My problems are that, i can only create one radnotification at a time, if i have one created and i hit the radbutton again the first radnotification dissapears and the new one appears, is it not possible to create a sort of notoficationfactory?.

    Here goes my code:
    Private Const width As Integer = 300
    Private Const height As Integer = 100
    Dim number As Integer = 0
    Protected Sub RadButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadButton1.Click
        Dim text As RadTextBox = New RadTextBox()
        text.Width = Unit.Pixel(200)
        Dim note As RadNotification = New RadNotification()
        note.Width = Unit.Pixel(width)
        note.Height = Unit.Pixel(height)
        note.AutoCloseDelay = 0
        note.Pinned = False
        note.Position = NotificationPosition.Center
        note.ShowCloseButton = True
        note.ContentIcon = Nothing
        note.TitleIcon = Nothing
        note.ID = "RadNotification" & number
        form1.Controls.Add(note)
        note.Show()
    End Sub
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 19 Oct 2011 Link to this post

    Hi,

    Please note that when creating controls dynamically you need to recreate them after each postback or they will be disposed as they were not originally in the control tree. This is the way ASP works and this limitation also applies to the RadNotification. A simple example is available in this FAQ thread from the ASP forum and you can also examine this online demo that also shows a way of recreating controls after an AJAX request. It shows how to work with user controls, yet the logic for recreating a control is up to the developer.

    As for dragging the notification - this is not possible and it not supported by the RadNotification. There are two other draggable controls in the suite, however - the RadWindow and the RadDock.

    If you want the user to receive multiple messages and that they are draggable you may consider the RadAlert dialog.


    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