2013-05-06 131 views
0

下面是我正在使用的当前视图,我想向它添加DetailView。我曾尝试过很多例子,即使我使用telerik演示代码,但没有任何代码似乎工作。任何人都可以告诉我一些代码如何做到这一点。每一排的DetailView应"detailViewCategory"填写所示模型DetailView在Telerik MVC Grid Razor

查看

@(Html.Telerik().Grid(Model.Mappings)   
       .Name("Grid") 
       .Scrollable(c => c.Height("200px")) 
       .Columns(columns => 
       { 
        columns.Bound(o => o.nopCategoryID).Hidden(true); 
        columns.Bound(o => o.nopCategory).Width(100).Title("Category");        

        columns.Bound(e => e.ClockCategory).Width(200).Title("Mapped To").Template(t => t.ClockCategory.Replace(",", "<br />")); 

        columns.Bound(o => o.nopCategoryID) 
             .Width(50) 
             .Centered() 
             .Template(o => Html.ActionLink("Edit", "EditProduct", new { id = o.nopCategoryID })) 
             .Title("Edit"); 
        columns.Bound(o => o.nopCategoryID) 
             .Width(50) 
             .Centered() 
             .Template(o => Html.ActionLink("Delete", "DeleteMapping", new { id = o.nopCategoryID })) 
             .Title("Delete");   
       }) 

       ) 

型号

public class C_Category 
    { 
     public int nopCategoryID { get; set; }  
     public string nopCategory { get; set; } 
     public string ClockCategory { get; set; } 

     public DetailViewCategory detailViewCategory { get; set; } 
    } 

DetailViewCategory

public class DetailViewCategory 
{ 
    public int nopCategoryID { get; set; } 
    public int ClockCategoryID { get; set; } 
    public string ClockCategory { get; set; } 
} 

回答

0
.DetailView(details => details.ClientTemplate(

      Html.Telerik().TabStrip() 
       .Name("TabStrip_<#= nopCategoryID#>") 
       .SelectedIndex(0) 
       .Items(items => 
       { 
        items.Add().Text("Details").LoadContentFrom("ActionName", "ControllerName", new { id = "<#= nopCategoryID#>"}); 
       }) 
       .ToHtmlString() 
    ))