I have a menu component on my view, which gives access to actions that relate to the current record on screen - so in effect I need to have the menu items have URLs similar to the following :
/Controller/Action/{cust_id}/{action_type}
Where {cust_id} will relate to the main record loaded, and {action_type} is rendered from a list within the model of all the available actions. The text for the URLs need to show the action name.
I have tried binding my menu to the Model as per the code below - is there a recommended way to pass in the variable elements, or do I have to abandon the ActionName and ControllerName below, and just construct the whole Url manually? I have put pseudo code in to show what I mean :
@(
Html.Kendo().Menu()
.Name("menu") // The name of the Menu is mandatory. It specifies the "id" attribute of the widget.
.BindTo(Model.TaskTypes, mappings =>
{
mappings.For<CRM.Core.CRM.TaskType>(binding => binding // Define the first level of the Menu.
.ItemDataBound((item, type) => // Define the mapping between the Menu item properties and the model properties.
{
item.Text = type.TaskTypeName;
item.ActionName = "New";
item.ControllerName = "Task";
item.SomePropertyHere = model.CustomerId;
item.SomeOtherPropertyHere = type.TaskTypeId;
}));
})
)