views:

75

answers:

1

What im trying to do is have an edit button that instead of opening the line for editing, it forwards you to a page where you can edit. Is this possible? I tried something with the client template, but the grid render is ignoring it completely.

+1  A: 

Yes, you can place a component into a grid column. Heres an example of how I bound the Id column with an Action link to the edit action passing in the Id.

I've removed the other columns from the template for clarity.

        Html.Telerik().Grid(Model)
            .Name("Items")
            .DataKeys(keys => { keys.Add(x => x.Id); })
            .Columns(columns =>
            {
                columns.Bound(x => x.Id).Title("").Format(Html.ActionLink("edit", "Edit", new { id = "{0}" }).ToHtmlString()).Encoded(false).Width(60);
            })
            .Render();
Kelly Ethridge
Can i give the html.actionlink a css class?
John Stuart
Sure. It uses the normal Html helper method so: Html.ActionLink("edit", "Edit", new { id = "{0}", @class="mycss" }
Kelly Ethridge
I air coded the last comment. Updated: Html.ActionLink("edit", "Edit", new { id = "{0}"}, new { @class="mycss" })
Kelly Ethridge