I am new to Kendo and are trying to add a custom command to a grid. I have been going over example pages, StackOverflow, and Telerik's site and found multiple examples that has the following:
columns.Command(command =>
{
command.Custom("Details").Text("Show Details").Action("Details", "Billing");
});
When I try to use this, I get the following error:
'GridCustomActionCommandBuilder' does not contain a definition for 'Action' and the best extension method overload 'UrlHelperExtensions.Action(IUrlHelper, string, object)' requires a receiver of type 'IUrlHelper'
I then tried this example from telerik:
columns.Template(@<text>@Html.ActionLink("Edit", "Home", new { id = item.ProductID })</text>);
But get this error:
Cannot convert lambda expression to type 'string' because it is not a delegate type
Just to confirm what is causing the error, then took out the ActionLink and used only this:
columns.Template(@<text>
<div>help me!!</div>
</text>);
and got the same error:
The total code snippet looks like this:
@(Html.Kendo().Grid<OrganisationEmployeesViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.EmployeeID).Visible(false);
columns.Template(@<text>
<div>help me!!</div>
</text>);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Employees_Read", "Organisations"))
)
.Deferred()
)
I am using existing samples but don't know what is wrong.
~/Content/kendo/2016.1.226/kendo.common.min.css ~/Content/kendo/2016.1.226/kendo.mobile.all.min.css ~/Content/kendo/2016.1.226/kendo.dataviz.min.css ~/Content/kendo/2016.1.226/kendo.flat.min.css ~/Content/kendo/2016.1.226/kendo.dataviz.flat.min.css ~/Scripts/kendo/2016.1.226/jquery.min.js ~/Scripts/kendo/2016.1.226/jszip.min.js ~/Scripts/kendo/2016.1.226/kendo.all.min.jsThat I use for my applications. Your code doesn't seem to give me errors. also don't forget to add JQUERY in nuget package manager. - counterflux.Action("Details", "Billing")have you tried.Click("Details", "Billing")? - ShawnOrr