Dynamically Add/delete Pages at runtime

6 posts, 0 answers
  1. Alan
    Alan avatar
    14 posts
    Member since:
    Jan 2007

    Posted 15 Sep 2010 Link to this post

    I need to add/remove pages to a Pageview at runtime based on the result of a query.  Initially the control has one page.

    I also need a mouseclick and mousedoubleclick event for each page added.

    And finally I need to add buttons and other controls to each page with a click event for each.

    Help!



  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 17 Sep 2010 Link to this post

    Hi Alan,

    Please refer to the next code snippet that demonstrates the answers to your questions:
    Imports Telerik.WinControls.UI
     
    Public Class Form1
        'Creating events
        Friend WithEvents page As New RadPageViewPage()
        Friend WithEvents page2 As New RadPageViewPage()
     
        Private Sub RadButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButton1.Click
            'I am using mouse click instead of your query event
     
            'Dynamically adding RadPageViewPages
            page.Text = "My Page"
            RadPageView1.Pages.Add(page)
     
            page2.Text = "My Page2"
            RadPageView1.Pages.Add(page2)
     
            'Dynamically adding a button
            Dim button As New RadButton()
            button.Text = "My Button"
            page.Controls.Add(button)
     
        End Sub
        'Handling the created events
        Private Sub page_MouseClick(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles page.MouseClick
            'do smth
        End Sub
     
        Private Sub page_MouseDoubleClick(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles page.MouseDoubleClick
            'do smth
        End Sub
     
    End Class

    Addintional information regarding RadPageView and the rest of our controls can be found in our help section.

    All the best,
    Stefan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. scart
    scart avatar
    5 posts
    Member since:
    Feb 2011

    Posted 26 Mar 2011 Link to this post

    Hi 
    i know its an old post but im interested in adding Radpageview pages dynamically too, the only thing that i dont like in the provided code above is that i dont know the exact number of pages i need to add . it depend on users inputs on database, so why its not like the general VB tab controls or treeview, simply tab.add works, any way is their a workaround to this.

    thx
  5. scart
    scart avatar
    5 posts
    Member since:
    Feb 2011

    Posted 26 Mar 2011 Link to this post

    Hi 
    i know its an old post but im interested in adding Radpageview pages dynamically too, the only thing that i dont like in the provided code above is that i dont know the exact number of pages i need to add . it depend on users inputs on database, so why its not like the general VB tab controls or treeview, simply tab.add works, any way is their a workaround to this.

    thx
  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 26 Mar 2011 Link to this post

    Hello,

    All this is doing is adding a page to a tab, so the the number of tabs you add can be performed in a loop. There is a help topic here on adding pages manually that may also help you

    Regards,
    Richard
  7. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 30 Mar 2011 Link to this post

    Hi scart,

    Thank you for writing.

    I am not sure what prevents your from dynamically adding pages based on user input. Please share the full details of your scenario and I will try to point you to the right direction.

    I am looking forward to your reply.
     
    Regards,
    Stefan
    the Telerik team
Back to Top
UI for WinForms is Visual Studio 2017 Ready