PageIndexChanging not firing

4 posts, 0 answers
  1. M Patrick
    M Patrick avatar
    6 posts
    Member since:
    May 2012

    Posted 09 Jan 2014 Link to this post

    I need to detect when the user changes pages by clicking on a tab. If certain conditions are not met, then I want to programmatically cancel the change. I see two events that might allow me to do this.

    PageIndexChanging provides a CurrentIndex, NewIndex and Cancel properties. This would seem to do what I want but it does not fire when a page tab is clicked with a mouse.

    SelectedPageChanging event does fire when the user clicks on a page tab. However, it does not contain a CurrentIndex, NewIndex or Cancel property. It does not seem to meet my needs.

    What event should I use to detect when a user changes page tabs with a mouse and gives me programmatic control over the change?

    thanks,
    pat
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 09 Jan 2014 Link to this post

    Hello Pat,

    Thank you for writing.

    SelectedPageChanging is the event you need. In the event arguments you have the page that is going to be selected (e.Page), and from the SelectedPage property of the control, you can get the currently selected page:
    void radPageView1_SelectedPageChanging(object sender, RadPageViewCancelEventArgs e)
    {
        RadPageViewPage currentPage = radPageView1.SelectedPage;
        RadPageViewPage newPage = e.Page;
    }

    I hope this helps. 

    Regards,
    Stefan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. M Patrick
    M Patrick avatar
    6 posts
    Member since:
    May 2012

    Posted 09 Jan 2014 Link to this post

    Yes. That does help and gets me part way to what I am trying to accomplish. From the code you posted I was able to convert to Visual Basic and get the name of the tabs. But I still do not understand how to CANCEL the change in Tabs if my criteria is not met.

    How do I prevent the changing of pages in this event?

    thanks,

    pat

  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 10 Jan 2014 Link to this post

    Hi,

    In all cancelable events in our suite, in the event arguments there is a property Cancel. When you set it to true, you cancel the operation:
    e.Cancel = True

    I hope that you find this information useful.  

    Regards,
    Stefan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top