Hi
I have the menu below which is dynamically created from the database. It shows Category and their respective SubCategories. I also have the url that it needs to navigate to stored in the database. How can I load the relevant url when the user clicks on a menu item?
The code for my menu is:
@(Html.Kendo().Menu()
.Name("Menu")
.BindTo(Model.categories, mappings =>
{
mappings.For<PhytClean.Models.DB.Category>(
binding => binding.ItemDataBound((item, category) =>
{
item.Text = category.CategoryName;
}).Children(category => category.SubCategories)
);
mappings.For<PhytClean.Models.DB.SubCategory>(binding => binding.ItemDataBound((item, subCategory) =>
{
item.Text = subCategory.SubCategoryName;
}));
})
)
I tried using the following to see if it would get me the URL field from that database entity but it returns "undefined"
<script type="text/javascript">
$(function () {
$("#Menu").kendoMenu({
select: function (e) {
var url = $(e.item).find(".k-link").attr("URL");
}
});
});
</script>
Any assistance would be appreciated.
Thanks