I've added a custom command, "Details", to the rows in my grid so a user can view the details about the row. When clicked, I want it to access the Details action in my HomeController. However, when I build my solution, I receive the following error message:
"Custom command routes is available only for server binding."
Can someone please tell me how I can correct this issue? My ulitimate goal is to create custom command buttons for Add, Edit, Delete, and Details, so my existing Views will be presented, rather than using the inline editing. I need to create these custom buttons because the default command buttons don't seem to permit routing to my Views. Anyway, I would appreciate your help.
Thanks,
Mike
.Columns(columns =>
{
columns.Command(p => { p.Custom("ViewDetails").Action("Details", "Home").Text("Details"); }).Width(160);
columns.Bound(p => p.CustomerId)
})
16 Answers, 1 is accepted
As the messages describes the ActionLink command is available only for Server binding. If you want to create a buttom with which points to a different view when using Ajax binding you can use a template column with a hyperlink inside of it.
columns.Template(@<text></text>).ClientTemplate(
"<a href='"
+Url.Action(
"Edit"
,
"Home"
)+
"/#=PersonID#'>Edit</a>"
);
Kind Regards,
Petur Subev
the Telerik team
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-custom-commands.html#AjaxCommand
Very frustrating looking to the documentation for any sort of answers or guidance.
The topic is covered in the following FAQ section of the documentation.
Have a great day!
Regards,
Dimiter Madjarov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Error 1 Inline markup blocks (@<p>Content</p>) cannot be nested. Only one level of inline markup is allowed. How can the Url.Action be drawn in an Ajax loaded child grid?
You can try this:
.ClientTemplate(
"<a href='"
+ Url.Action(
"Index"
,
"Home"
) +
"'>Home</a>"
);
Regards,
Atanas Korchev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
You should use a Command column to get the built-in edit command:
columns.Command(commands => commands.Edit());
Regards,
Atanas Korchev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
I am new to KendoUI Grid Can let me know From where PersonId Came from.
I am trying but Parameter is not passing to the action method.
Could you help me no this.
Hello Srinivasa,
PersonID refers to the id property from the Grid model and is appended to the link in the template.
Regards,Dimiter Madjarov
Telerik
I am trying to use the example above:
columns.Template(@<text></text>).ClientTemplate(
"<a href='"
+Url.Action(
"Edit"
,
"Home"
)+
"/#=PersonID#'>Edit</a>"
);
but keep on receiving the following error whenever I have @<text></text>
"Cannot convert lambda expression to type 'string' because it is not a delegate type"
Why is it that I cannot use @<text> in my Razor code to explicitly define this content?
Hello Deon van Staden,
The provided sample code looks correct. I assume it is not the reason for the mentioned error.
Regards,Dimiter Madjarov
Telerik
Hello Matthew,
Please provide further details about the Grid configuration on your end and if possible send us an isolated runnable example, so we could inspect it locally and provide assistance.
Regards,Dimiter Madjarov
Telerik by Progress
I was also trying to get the custom command to work and getting the server binding error. Here is a column that calls an action that looks like the kendo edit button vs. a link:
columns.Template(@<text></text>).ClientTemplate("<a href='" + Url.RouteUrl("Default", new { controller = "InsertYourControllerName", action = "InsertActionName" }) + "/#=InsertID#' class='k-button k-button-icontext'><span class='k-icon k-i-edit'></span>Edit</a>").Width(125);
Hello Gary,
Could you please provide the error you are facing?
Regards,Boyan Dimitrov
Telerik by Progress