开发者

Telerik MVC Grid Control Additional Column with ActionLink

Hi I am Using Telerik MVC Grid Control in my MVC 3.0 Project

I am trying to add Additional Column to the Grid

  columns.Template(e =>
开发者_运维知识库         @Html.ActionLink("Edit", "Action", "Controller",
         new { id = e.ID}, new { @class = "standard button" })
           );

This code is Creating an Additional Column But not displaying the Edit link in that column.

Can Any one Help me with this. How can make this work?


If you come from a WebForms (ASPX) ViewEngine world it can be a little confusing when working with column templates as traditionally you used to have to do columns.Template(e => .... );. However, with Razor we can now approach this a little differently. First of all, the usage of @ is embraced, so you don't need to use "e => ". Also, instead of having "e" we now can use the @item object which represents the entity tied to our Grid. So, this leaves us with the following snippet of code (which will produce the end-result you're looking for):

            columns.Template(
                @<text>
                    @(Html.ActionLink("Edit", "Action", "Controller", new { id = @item.ID }, new { @class = "standard button" }))
                </text>
            );
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜