This question is locked. New answers and comments are not allowed.
Hi, i have a possibly odd request. First off, i just started using this software today and it is amazing! If the devs see this, great job! Such a powerful tool. Anyways, my question:
I have a grid, and instead of using the built in edit/delete commands, i want to route to a controller action so i can do those commands in my own way, as well as some special commands that specific to my project. So my question is, can i put links into column fields?
I hope this makes sense, i normally have trouble conveying my problems.
I have a grid, and instead of using the built in edit/delete commands, i want to route to a controller action so i can do those commands in my own way, as well as some special commands that specific to my project. So my question is, can i put links into column fields?
I hope this makes sense, i normally have trouble conveying my problems.
5 Answers, 1 is accepted
0
0
John
Top achievements
Rank 1
answered on 08 Oct 2010, 05:22 PM
I think the link you gave me pushed me in the right direction, but im kind of stuck still.
The problem that Uma was having with this was that the html.actionlink was displaying as text. Which is the same problem i am having. Only he didnt post his solution.
columns.Bound(o => o.LocationId).Format(Html.ActionLink("Edit", "Edit", "Location",
new { id = "{0}", height = 550, width = 900, modal = "true" },
new { @class = "t-link action-edit thickbox" }).ToString()).Title(" ").Encoded(false).Width(25).Sortable(false).Filterable(false)
The problem that Uma was having with this was that the html.actionlink was displaying as text. Which is the same problem i am having. Only he didnt post his solution.
0
Accepted
Binu
Top achievements
Rank 1
answered on 08 Oct 2010, 05:29 PM
Use Ajax binding instead of server side binding, refer to sample project,
for edit link, define your column model like this
.Template is run on server, so you can create an action link, .ClientTemplate takes care of Ajax paging.
Hope this helps
for edit link, define your column model like this
.Columns(columns =>
{
columns.Bound(s => s.Name);
columns.Bound(s => s.Status);
columns.Template(s => Html.ActionLink("Edit", "EditView", new {s.Id}))
.ClientTemplate("<a href=\"" + Url.Action("EditView", "MyController") + "/<#= Id#>\">Edit</a>")
.Title("Edit");
}
)
.Template is run on server, so you can create an action link, .ClientTemplate takes care of Ajax paging.
Hope this helps
0
John
Top achievements
Rank 1
answered on 08 Oct 2010, 05:54 PM
That worked perfectly. Thanks!
0
Jeremy
Top achievements
Rank 1
answered on 01 Mar 2013, 06:03 PM
Here is a take on Binu's excellent answer that worked for me in Telerik MVC version 2012.1.214.
columns.Bound(o => o.CustId).Title("CustId").ReadOnly(true).Width(75)
.ClientTemplate("<a href=\"" + Url.Action("MyAction", "MyController") + "?id=<#=CustId#>\"><#=CustId#></a>");
columns.Bound(o => o.CustId).Title("CustId").ReadOnly(true).Width(75)
.ClientTemplate("<a href=\"" + Url.Action("MyAction", "MyController") + "?id=<#=CustId#>\"><#=CustId#></a>");