Hybrid View HtmlHelper Overview
The hybrid Telerik UI View HtmlHelper for ASP.NET MVC is a server-side wrapper for the hybrid Kendo UI View widget.
The View represents a screen in the mobile Application.
Basic Configuration
- Create a new ASP.NET MVC 5 application. If you have installed the Telerik UI for ASP.NET MVC Visual Studio Extensions, create a Telerik UI for ASP.NET MVC application. If you decide not to use the Telerik UI for ASP.NET MVC Visual Studio Extensions, follow the steps from the introductory article to add Telerik UI for ASP.NET MVC to the application.
-
Open
HomeController.cs
and modify theIndex
action method.public ActionResult Index() { return View(); }
-
Add a hybrid Telerik UI View to the
Index
view.@(Html.Kendo().MobileView() .Title("View Title") .Content( @<text> View Content Template </text> ) )
-
Initialize the mobile application.
@(Html.Kendo().MobileApplication() .ServerNavigation(true) )
Build and run the application.
Events
You can subscribe to all hybrid View events.
The following example demonstrates how to subscribe to events by a handler name.
@(Html.Kendo().MobileView()
.Name("MobileView")
.Events(events => events
.AfterShow("onAfterShow")
)
)
<script>
function onAfterShow() {
// Handle the show event.
}
</script>
Referencing Existing Instances
You can reference a hybrid View instance by using the jQuery.data()
method and the value specified through the Name()
method. Once a reference is established, use the hybrid View client-side API to control its behavior.
@(Html.Kendo().MobileView()
.Name("MobileView")
)
<script>
$(function() {
// The Name() of the View is used to get its client-side instance.
var view = $("#Mobileview").data("kendoMobileView");
});
</script>