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

How to use LinkButton controls instead of regular links

2 Answers 65 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Joe Gubbins
Top achievements
Rank 1
Joe Gubbins asked on 30 Apr 2020, 10:37 PM

I would like to change all the menu items that have a URL value to be LinkButtons instead of hyperlinks. That way, every time someone goes to another page, the master page form gets submitted. This will allow me to keep a hidden field persistent for all pages. Normally, I would use a session variable to accomplish this task, but we have a request to allow multiple tabs to be opened for the same site and allow the user to use the different tabs to work through different workflows without one tab affecting the other. I thought I could use the ItemTemplate section to change the links to linkbuttons, but I don't know how to structure it.

 

Thanks.

2 Answers, 1 is accepted

Sort by
0
Joe Gubbins
Top achievements
Rank 1
answered on 01 May 2020, 02:04 PM
I forgot to mention, I'm loading the menu from XML data, if that makes a difference.
0
Peter Milchev
Telerik team
answered on 05 May 2020, 12:06 PM

Hello Joe,

Using the LinkButton will skip all of the RadMenu events, both client-side and server-side. 

What I can suggest reviewing is using the NavigateUrl and doing your logic in the OnClientItemClicking event, where you can cancel the navigation and execute a custom script, similar to the one of the LinkButton:

On the templates themselves, you can use a Global template or add a dynamic template for each node:

Regards,
Peter Milchev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Menu
Asked by
Joe Gubbins
Top achievements
Rank 1
Answers by
Joe Gubbins
Top achievements
Rank 1
Peter Milchev
Telerik team
Share this question
or