What is the simplest way of doing this?
@(Html.Kendo().Menu()
.Name(
"mainMenu"
)
.Items(items => {
items.Add().Text(
"Monitors"
).Action(
"Index"
,
"Home"
).Items(subItems => {
subItems.Add().Text(
"Monitors Requiring Admin"
).Action(
"Index"
,
"Home"
);
});
items.Add().Text(
"Aliases"
).Action(
"Index"
,
"Aliases"
);
})
)
Cheers,
Nick
11 Answers, 1 is accepted
You could add the query string parameters as a RouteValueDictionary to your Action method.
E.g.
@{
RouteValueDictionary routeValues =
new
RouteValueDictionary();
routeValues[
"MonitorGrid-filter"
] =
"HasBeenAdministered~eq~false"
;
}
subItems.Add().Text(
"Monitors Requiring Admin"
).Action(
"Index"
,
"Home"
, routeValues);
Kind regards,
Dimiter Madjarov
the Telerik team
Seems odd there isn't just a .QueryString method or something though :\
I am glad that this approach worked for you. If you think that adding a .QueryString method would be a useful feature, you may consider posting it in our User Voice Portal. If it gathers enough interest from the community, we will consider it for one of our future releases.
Dimiter Madjarov
the Telerik team
Hi Nick,
from the above example if I mention the are its not working. can you help the syntax how to use with Area information.
eg:
@{ RouteValueDictionary routeValues = new RouteValueDictionary(); routeValues["MonitorGrid-filter"] = "HasBeenAdministered~eq~false";}
subItems.Add().Text("Monitors Requiring Admin").Action("Index", "Home", new {area ="Test", routeValues});
Hello Kiran,
Could you elaborate what is the exact issue that you are experiencing? If possible please provide an isolated runnable example that demonstrates the problem so we could inspect it locally and provide further assistance.
Regards,
Telerik
See What's Next in App Development. Register for TelerikNEXT.
I am facing two challenges.
1. Passing the Encryption Route Dictionary and use then as parameters in ActionResult. (due to security)
if there any sample on it or example on it.
2. Passing multiple Route Dictionary values to menu action().
Thanks,
Kiran
Hello Kiran,
I tried the approach from the previous post in order to add multiple values to the Route Dictionary and it works as expected. Could you test it on your end?
Regarding the "Encryption Rout Dictionary" I am not exactly sure what are you referring to. Please send a sample code that demonstrates the case.
Regards,Dimiter Madjarov
Telerik
See What's Next in App Development. Register for TelerikNEXT.
Hi Dimiter,
The multiple values to the Route Dictionary is working.
But, I am looking to work with encryption values,
Ex: http://localhost:1234/Test_&*sdfdsfsdfdsfsdfsdfsdsdfsdfdssd
like this. when I click on this kind of line how I can redirect to my route page.?
any example on encrypted route value parameters.
Thanks,
Kiran
Hello Kiran,
There is no such example at the moment, as the Menu does not have built in functionality for encrypting values. You could check the following page that demonstrates a sample approach on how to achieve this.
Regards,Dimiter Madjarov
Telerik
See What's Next in App Development. Register for TelerikNEXT.
Hi Dimiter,
My context menu is targeted on a Telerik grid. So when user right clicks on the grid and selects a context menu option, I need to pass in some of the dataItems's of the selected row of the grid as parameter to the Action method of the selected context menu item. How can I achieve this?
I already reply in the original thread regarding the ContextMenu and Grid integration. To facilitate the communication, let's keep the discussion in one thread.
For your convenience, I am pasting the reply here too:
In order to pass the selected row's dataItem of the Grid to the controller for the specific ContextMenu item selected, I could think of two approaches:
1. Perform an ajax request on Context Menu Item selection and pass the required data to the server. I suppose that you are aware of this approach as you have mentioned in a comment that you have already tried it. But if i understand correctly, this approach interfere the export to pdf functionality of your project.
2. Store the required fields of the dataItem in a HiddenField. This way you will be able to change its value on the client-side on open of the ContextMenu.
Please, give a try the approach with hidden field and let me know if it fits your scenario.
Regards,
Joana
Progress Telerik