开发者

Regarding Telerik grid

we know that in telerik grid we will use like this

<% Html.Telerik().Grid(Model.Terminology.Contents).Name("TerminologyCategories")
  .Columns(column =>
  {
      column.Bound(termContent => termContent.Language.Name).Title("Language");
      column.Bound(termContent => termContent.Data).Title("Text");
      column.Template(termContent => Html.ActionLink("Edit", "#",
   开发者_高级运维   new { id = termContent.ID, termid = termContent.Terminology.ID },
      new { onclick = "editContentDialog(" + termContent.ID + "); return false;" })).Title("Action");
      column.Bound(termContent => termContent.Updated);
      column.Bound(termContent => termContent.aspnet_Users.UserName);

  }).Render();
%>

Suppose in the row:

column.Template(termContent => Html.ActionLink("Edit", "#",
    new { id = termContent.ID, termid = termContent.Terminology.ID },
    new { onclick = "editContentDialog(" + termContent.ID + "); return false;"     })
).Title("Action");

I want to use create or edit link based on termContent.Data is there or not in such case how can I use if else condition in the telerik column.template or column.bound property can anyone guid me. I got struct in it.please anyone can help me

Thanks Manjunath


It sounds like you want your template to be conditional, if so, then this should get you going in the right direction.

 .Columns(columns =>
 {
     columns.Template( 
           @<text>
           <input name="cbxStatus" type="checkbox" value="@item.status_cd" title="cbxStatus" 
              @if (item.status_cd == "A")
              {
                  <text>checked="checked"</text>
              }
              @if (item.status_cd == "I")
              {
                  <text>checked="unchecked"</text>
              }
           />
           </text>);
    columns.Bound(p => p.date_added).Width(125);
    columns.Bound(p => p.account_name).Width(100);
 })
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜