I'm trying to add and remove handlers as a page is loaded and unloaded using the RAdPageVIew Control.
I am subscribing to both SelectedPageChanging and SelectedPageChanged events to monitor when appropriate pages load, however I cannot seem to retain the previous page in order to know which handlers to remove. I also can't seem to get the PageIndexChanged event to fire -at all.
I'm using VB.net with the latest build of WinForm controls.
Can I get a sort example to determine which page is closing and which one is opening.
I appreciate the help.
I am subscribing to both SelectedPageChanging and SelectedPageChanged events to monitor when appropriate pages load, however I cannot seem to retain the previous page in order to know which handlers to remove. I also can't seem to get the PageIndexChanged event to fire -at all.
I'm using VB.net with the latest build of WinForm controls.
Can I get a sort example to determine which page is closing and which one is opening.
I appreciate the help.
4 Answers, 1 is accepted
0
Hello Bob,
Thank you for writing.
To achieve your requirement, you can subscribe to the SelectedPageChanging event. Its event arguments provide the page that is about to be selected and you can get the old selected page from the SelectedPage property of RadPageView since at the moment of firing the SelectedPageChanging event the SelectedPage has not yet been changed. The following code snippet demonstrates this:
As to the PageIndexChanged event, this event is fired when a specific page changes its position amongst the other pages. It should not fire when just changing the selected page.
I hope this will help you.
A bit off topic, I would like to remind you that your trial support package has expired. If you would e to continue receiving support from us, you will have to consider a purchase of some of the licenses that we offer. At this link - http://www.telerik.com/purchase.aspx - you can find the available options. These licenses come with Dev priority support where the tickets should be answered in a guaranteed period of time. Shortly said, we will provide you with quicker responses.
Feel free to ask if you have any additional questions.
Kind regards,
Ivan Todorov
the Telerik team
Thank you for writing.
To achieve your requirement, you can subscribe to the SelectedPageChanging event. Its event arguments provide the page that is about to be selected and you can get the old selected page from the SelectedPage property of RadPageView since at the moment of firing the SelectedPageChanging event the SelectedPage has not yet been changed. The following code snippet demonstrates this:
private
void
radPageView1_SelectedPageChanging(
object
sender, RadPageViewCancelEventArgs e)
{
Console.WriteLine(
"Changing from "
+
this
.radPageView1.SelectedPage +
" to "
+ e.Page);
}
As to the PageIndexChanged event, this event is fired when a specific page changes its position amongst the other pages. It should not fire when just changing the selected page.
I hope this will help you.
A bit off topic, I would like to remind you that your trial support package has expired. If you would e to continue receiving support from us, you will have to consider a purchase of some of the licenses that we offer. At this link - http://www.telerik.com/purchase.aspx - you can find the available options. These licenses come with Dev priority support where the tickets should be answered in a guaranteed period of time. Shortly said, we will provide you with quicker responses.
Feel free to ask if you have any additional questions.
Kind regards,
Ivan Todorov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Bob
Top achievements
Rank 2
answered on 31 May 2012, 03:45 PM
Thank you for the response.
I have attemped to perform this operation in VB and I am not getting the same results. In-fact, I am receiving some errors. I have tried the code in c# and it did work, but I can't rewrite the existing app into c# at this time.
In the various ways I have attempted to write the code in VB I cannot appear to get any information back without receiving some sort of error. Can I get a VB sample on how to catch the name of the current page and the new page so I can write a case statement to perform some event handling.
I know this is a simple event, but I'm having difficulties using this event.
Your help is appreciated.
As for the other item, I have put a request in with my company, we'll see if they approve it.
Thanks
I have attemped to perform this operation in VB and I am not getting the same results. In-fact, I am receiving some errors. I have tried the code in c# and it did work, but I can't rewrite the existing app into c# at this time.
In the various ways I have attempted to write the code in VB I cannot appear to get any information back without receiving some sort of error. Can I get a VB sample on how to catch the name of the current page and the new page so I can write a case statement to perform some event handling.
I know this is a simple event, but I'm having difficulties using this event.
Your help is appreciated.
As for the other item, I have put a request in with my company, we'll see if they approve it.
Thanks
0
Bob
Top achievements
Rank 2
answered on 31 May 2012, 03:53 PM
OK - after I clicked the submit button, I dug a little deeper into documentation and trial and error and I think I got it to work in VB.
I had to create a new variable of type RadPageViewPage, then assign the value to the SelectedPage. That allowed me to get the properties of the page, while e.page.name provides me the name of the page changing too.
A little confusing at first, but I think I got it.
Thanks for the help.
Bob
I had to create a new variable of type RadPageViewPage, then assign the value to the SelectedPage. That allowed me to get the properties of the page, while e.page.name provides me the name of the page changing too.
A little confusing at first, but I think I got it.
Thanks for the help.
Bob
0
Hi Bob,
I am glad that you have managed to sort this out. Nevertheless, here are some thoughts about this.
I think that the problem with VB is that it handles the events in a bit different manner and also requires you to call the ToString method of the pages. In VB, when you use the Handles clause, the event is hooked at an earlier moment and you might get it fired with some of the two properties equal to Nothing which causes a reference exception. To avoid the null reference error, you can use the Convert.ToString method:
I hope you find this useful.
Greetings,
Ivan Todorov
the Telerik team
I am glad that you have managed to sort this out. Nevertheless, here are some thoughts about this.
I think that the problem with VB is that it handles the events in a bit different manner and also requires you to call the ToString method of the pages. In VB, when you use the Handles clause, the event is hooked at an earlier moment and you might get it fired with some of the two properties equal to Nothing which causes a reference exception. To avoid the null reference error, you can use the Convert.ToString method:
Private
Sub
RadPageView1_SelectedPageChanging(sender
As
System.
Object
, e
As
Telerik.WinControls.UI.RadPageViewCancelEventArgs)
Handles
RadPageView1.SelectedPageChanging
RadMessageBox.Show(
"Changing from "
& Convert.ToString(
Me
.RadPageView1.SelectedPage) &
" to "
& Convert.ToString(e.Page))
End
Sub
I hope you find this useful.
Greetings,
Ivan Todorov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>