Rank: Newbie Groups: Member
Joined: 5/10/2011 Posts: 9
|
Hi, I am using your SlideMenu control and I would like to be able to test for a broken link when a menu item is clicked and display a custom error message popup.
At first I tried to use the RaiseServerEvent to capture the ItemClick event but I couldn't get the event to be raised. I then used the ClientSideOnItemClick to raise a client side event and then used your ScriptEvent control to raise it on the server.
I can test for the validity of the NavigateURL on the server and I would like to be able to cancel the click event so the user remains on the same page and display an error message if it is not valid.
Is it possible to cancel the navigation from the server side event?
Thanks
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
To raise a server side event on the SlideMenu control, you will need to set the SlideMenu's RaisesServerEvent to true. Also SlideMenu will not raises server event when you have NavigateUrl set.
It is possible to do what you wanted to do. However you would not rely on "canceling navigation". You can check whether the Url is valid and then call Response.Redirect to go to that Url if it is valid and does nothing (or display an error message) when it is invalid. That means you will rely on your own code, instead of the SlideMenu to redirect to another page for you. To achieve that you must NOT set the slide menu item's NavigateUrl. If you need to store NavigateUrl somewhere, you can store it inside the item's Value property.
Hope this helps. Please feel free to let us know if you have any more questions.
Thanks
|
Rank: Newbie Groups: Member
Joined: 5/10/2011 Posts: 9
|
Yes, thats exactly what I wanted to do...and you answered the mystery of why RaiseServerEvent didn't work...2 for the price of one.
Thanks for your help.
|