Server Detail Template
| First Name | Last Name | Title | Country | City | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Nancy | Davolio | Sales Representative | USA | Seattle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Andrew | Fuller | Vice President, Sales | USA | Tacoma | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Janet | Leverling | Sales Representative | USA | Kirkland | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Margaret | Peacock | Sales Representative | USA | Redmond | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Steven | Buchanan | Sales Manager | UK | London | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
About this example ASPXRazor
This example shows how to use the server detail template - the detail template used in server binding scenarios.
Important notes:
- Use the
Templatemethod to set the server template (used only for server binding scenarios). - Make sure the
Nameof any UI component defined in the template is unique. A property of the bound object can be used to ensure such uniqueness:Name("TabStrip_" + e.EmployeeID). -
Calling the
Rendermethod is required in order to output the contents of any UI components defined in the server detail template.
Example:
<% Html.Telerik().Grid(Model)
.Name("Employees")
.DetailView(detailView => detailView.Template(e =>
{
%>
<% Html.Telerik().TabStrip()
.Name("TabStrip_" + e.EmployeeID)
.SelectedIndex(0)
.Items(items =>
{
items.Add().Text("Orders").Content(() =>
{
%>
<%= Html.Telerik().Grid(e.Orders)
.Name("Orders_" + e.EmployeeID)
.Pageable()
.Sortable()
%>
<%
});
items.Add().Text("Contact Information").Content(() =>
{
%>
<div class="employee-details">
<ul>
<li>
<label>Birth Date:</label><%= e.BirthDate.Value.ToString("d") %>
</li>
<li>
<label>Country:</label><%= e.Country %>
</li>
<li>
<label>City:</label><%= e.City %>
</li>
<li>
<label>Address:</label><%= e.Address %>
</li>
<li>
<label>Home Phone:</label><%= e.HomePhone %>
</li>
</ul>
</div>
<%
});
})
.Render();
%>
<%
}))
.Pageable(paging => paging.PageSize(5))
.Sortable()
.Render();
%>
Interested in HTML5 and mobile-powered ASP.NET MVC apps?
Experience the next generation UI and framework for ASP.NET MVC development by downloading trial evaluation copy of Kendo UI Complete for ASP.NET MVC. Jumpstart your development with the available learning resources.
The differences between Telerik MVC Extensions and Kendo UI Complete for ASP.NET MVC, and their licensing models are explained here and here.
If you have any questions, do not hesitate to contact us at sales@telerik.com.