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

PageView - Late initialisation of pages

2 Answers 84 Views
PageView
This is a migrated thread and some comments may be shown as answers.
Ramius
Top achievements
Rank 1
Ramius asked on 16 Jun 2010, 05:40 PM
Hello,

i have created a complex RadPageView with 6 Pages and 12 RadGridViews, 8 Comboboxes and some other controls on it. Every RadGridview and every Combobox needs data from a database. As this initialisation will need some time when i initialise all controls at once in the forms load event, i would like to initialise the controls only when it is needed.

Now i would like to initialise the controls of a page of the RadPageView only when a user clicks on a page.

What would be the best way to do this ? 
Will the RadPageView support this scenario directly e.g. with a event which occurs, when a page needs initialisiation in the way i described above ? 
  
Kind Regards,

Ramius

2 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 17 Jun 2010, 03:57 PM
Hi Ramius,

Thanks for contacting us and for your question.

In your case, you could use the HandleCreated event of the Page to bind the controls inside it. You will have to subscribe for this event by iterating over all pages and when this event occurs, bind the corresponding controls to your datasource:

public Form1()
{
    InitializeComponent();
 
    foreach (RadPageViewPage page in this.pageView.Pages)
    {
        page.HandleCreated += new EventHandler(OnPageViewPage_HandleCreated);
    }
}
 
void OnPageViewPage_HandleCreated(object sender, EventArgs e)
{
    if (sender == this.radPageViewPage1)
    {
        this.BindGrid1();
    }
    else if (sender == this.radPageViewPage2)
    {
        this.BindGrid2();
    }
}

You could also use the SelectedPageChanged event and bind the corresponding controls but in this case you will have to keep track of the already initialized pages to avoid rebinding them.

I hope this helps.

Do not hesitate to get back to us in case of further questions.

Kind regards,
Deyan
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
Ramius
Top achievements
Rank 1
answered on 22 Jun 2010, 03:15 PM
Hello Deyan,

thank you for your help.

It works as expected.

Kind Regards,

Ramius
Tags
PageView
Asked by
Ramius
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Ramius
Top achievements
Rank 1
Share this question
or