2013-05-06 104 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() 
    ))