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

PageIndexChanging not firing

3 Answers 169 Views
PageView
This is a migrated thread and some comments may be shown as answers.
M Patrick
Top achievements
Rank 1
M Patrick asked on 09 Jan 2014, 11:18 AM
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

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 09 Jan 2014, 11:23 AM
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 >>
0
M Patrick
Top achievements
Rank 1
answered on 09 Jan 2014, 01:07 PM

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

0
Stefan
Telerik team
answered on 10 Jan 2014, 08:26 AM
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 >>
Tags
PageView
Asked by
M Patrick
Top achievements
Rank 1
Answers by
Stefan
Telerik team
M Patrick
Top achievements
Rank 1
Share this question
or