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

tag helper link

2 Answers 186 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 15 Oct 2018, 09:16 PM

Hi, I think this is a bug.  

This menu item will not work:

<menu-item text="Search1" asp-action="search" asp-controller="Client" link-html-attributes='new { data_attr = "custom value" }'></menu-item>

 

This menu item will work:

<menu-item text="Search" asp-action="_search" asp-controller="Client" link-html-attributes='new { data_attr = "custom value" }'></menu-item>

 

The only difference is the underscore.  The underscore can be anywhere in the action name, but if it's not there, Telerik won't build the link with the action.  

Are my actions required to have underscores? 

 

2 Answers, 1 is accepted

Sort by
0
Steve
Top achievements
Rank 1
answered on 15 Oct 2018, 09:34 PM

Further to this... If I define the following in my controller

public static string Name { get => "PracticeConsultation";} public static string SearchAction { get => "_Search"; }

 

Then do the following in my .cshtml:

<menu-item text="Search" asp-controller="@PracticeConsultationController.Name" asp-action="@PracticeConsultationController.SearchAction"> </menu-item>

 

This will also not work without the underscore.  However, the result is slightly different.  In my original post, the controller name would still be in the link, but the action name would not.  In this example, when referencing static variables, none of the link is built unless there is an underscore. 

0
Veselin Tsvetanov
Telerik team
answered on 18 Oct 2018, 01:35 PM
Hello Steve,

Attached you will find a small sample having a <kendo-menu> tag helper with the same item as the one that you mentioned is not working. You will notice that the navigation in this sample is performed properly and the respective view is loaded.

Regards,
Veselin Tsvetanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Menu
Asked by
Steve
Top achievements
Rank 1
Answers by
Steve
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Share this question
or