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.
Asked
Active
Viewed 5,985 times
0
-
http://stackoverflow.com/questions/2243898/displaying-standard-datatables-in-mvc w/ Model strongly typed as System.Data.DataTable – Madhu BK Apr 30 '15 at 05:47
2 Answers
6
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
- 1,669
- 1
- 11
- 12
-
-
Sure. It uses the normal Html helper method so: Html.ActionLink("edit", "Edit", new { id = "{0}", @class="mycss" } – Kelly Ethridge Oct 26 '10 at 17:14
-
I air coded the last comment. Updated: Html.ActionLink("edit", "Edit", new { id = "{0}"}, new { @class="mycss" }) – Kelly Ethridge Oct 26 '10 at 19:07
2
You can use Template method instead:
@(Html.Telerik().Grid(Model)
.Name("Items")
.DataKeys(keys => { keys.Add(x => x.Id); })
.Columns(columns =>
{
columns.Bound(x => x.Id)
.Title("")
.Template(@Html.ActionLink("edit", "Edit", new { x.id }))
.Width(60);
})
)

alx
- 21
- 1