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

Dynamically Add/delete Pages at runtime

5 Answers 209 Views
PageView
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 16 Sep 2010, 03:11 AM
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!



5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 17 Sep 2010, 08:59 AM
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
0
scart
Top achievements
Rank 1
answered on 26 Mar 2011, 06:20 PM
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
0
scart
Top achievements
Rank 1
answered on 26 Mar 2011, 06:22 PM
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
0
Richard Slade
Top achievements
Rank 2
answered on 26 Mar 2011, 06:37 PM
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
0
Stefan
Telerik team
answered on 30 Mar 2011, 03:58 PM
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
Tags
PageView
Asked by
Alan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
scart
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Share this question
or