This is a migrated thread and some comments may be shown as answers.

[Solved] MVC Telerik Grid: Output object parameter in detail View

0 Answers 17 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joel
Top achievements
Rank 1
Joel asked on 20 Jan 2013, 11:20 PM

I have implemented a telerik grid as described here. As in this statement below, parameters are accessed by enclosing them with the tags <#= and #> respectively.

<li><label>Country:</label><#= Country #></li>

I have an list of an object class defined as List<myClass> myList. myclass is defined as

public class myClass{
   public string param1{get; set;}
   public string param2{get; set;}
   public string param3{get; set;}

}

Now, in my list, List myList, I need to access param1 and param2 of each element in the list and output it in the detail view of my telerik grid. What is the syntax please? I am looking for something in the lines <#= mylist.param1 #>

The code look like

Html.Telerik().Grid<EmployeeViewModel>()
    .Name("Employees")
    .DetailView(details => details.ClientTemplate(
        Html.Telerik().TabStrip()
            .Name("TabStrip_<#= EmployeeID #>")
            .SelectedIndex(0)
            .Items(items =>
            {
                items.Add().Text("Orders").Content(
                        Html.Telerik().Grid<OrderViewModel>()
                            .Name("Orders_<#= EmployeeID #>")
                            .DataBinding(dataBinding => dataBinding.Ajax()
                            .Select("_OrdersForEmployeeDetailsAjax", "Grid", new { employeeID = "<#= EmployeeID #>" }))
                            .Pageable()
                            .ToHtmlString());
                items.Add().Text("Contact Information").Content(
                    "<div class='employee-details'>" +
                        "<ul>" + 
                            "<li><label>Birth Date:</label><#= $.telerik.formatString('{0:d}', BirthDate) #></li>" +
                            "<li><label>Country:</label><#= Country #></li>" +
                            "<li><label>City:</label><#= City #></li>" +
                            "<li><label>Address:</label><#= Address #></li>" +
                            "<li><label>Home Phone:</label><#= HomePhone #></li>" +
                        "</ul>" +
                    "</div>"    
                    );
            })
            .ToHtmlString()
    ))
    .DataBinding(dataBinding => dataBinding.Ajax().Select("_EmployeesDetailsAjax", "Grid"))
    .Scrollable(scrolling => scrolling.Height(555))
In addition to the items in the detail view(birth day, country, city, address), I want to a list of object parameter associated with each row of data.

Tags
Grid
Asked by
Joel
Top achievements
Rank 1
Share this question
or