PageView - Late initialisation of pages

3 posts, 0 answers
  1. Ramius
    Ramius avatar
    127 posts
    Member since:
    Feb 2008

    Posted 16 Jun 2010 Link to this post

    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. Deyan
    Admin
    Deyan avatar
    2038 posts

    Posted 17 Jun 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ramius
    Ramius avatar
    127 posts
    Member since:
    Feb 2008

    Posted 22 Jun 2010 Link to this post

    Hello Deyan,

    thank you for your help.

    It works as expected.

    Kind Regards,

    Ramius
Back to Top