Telerik控制标签

时间:2012-11-29 20:20:14

标签: asp.net-mvc telerik-mvc

我有一个包含许多标签的标签条。我需要为我的子标签分配一个id。我需要在此处为​​标签Demo指定id。请帮助解决这个问题

 Html.Telerik().TabStrip().Name("Tab1")
       .Items(items =>
       {
           items.Add()
               .Text("Demo").HtmlAttributes(new { onclick = "return  warnOfChanges()" })
               .LoadContentFrom("EDemo", "W2Generation", new {q=Type.Error, cId = Model.C.CId, eId = Model.SelectedE,fYear = Model.Selectedyear });
           items.Add().HtmlAttributes(new { onclick = "return  warnOfChanges()" })

1 个答案:

答案 0 :(得分:1)

您可以将ID添加为HtmlAttribute。

items.Add()
           .Text("Demo").HtmlAttributes(new { onclick = "return  warnOfChanges()", id = "demoTab"})
           .LoadContentFrom("EDemo", "W2Generation", new {q=Type.Error, cId = Model.C.CId, eId = Model.SelectedE,fYear = Model.Selectedyear });