This example shows how to bind Telerik PanelBar for ASP.NET MVC to a collection of objects.
The required steps are:
public ActionResult DataBindingToModel()
{
ViewData["panelbarData"] = NavigationDataBuilder.GetCollection();
return View();
}
<%= Html.Telerik().PanelBar()
.Name("PanelBar")
.BindTo((IEnumerable<NavigationData>)ViewData["panelbarData"],
(item, navigationData) =>
{
item.Text = navigationData.Text;
item.ImageUrl = navigationData.ImageUrl;
item.Url = navigationData.NavigateUrl;
})
%>
You can prevent the normal behavior of the link (navigating to the specified url), with e.preventDefault(); method. The same approach is used in this example.