passing parameter to Html.ActionLink in a Kendo Grid

1 Answer 74 Views
Grid
Raymond
Top achievements
Rank 1
Veteran
Iron
Raymond asked on 18 Oct 2024, 01:33 PM

hi everybody,

I have this grid that works well, and pass the id=0 when clicking on the icon, unfortunately I can't find away to pass the hidden ID value.

is there something I am missing here.

I appreciate any help from you guys

regards, Ray

@(Html.Kendo().Grid<HeatersLibrary.Models.DocumentsViewModel>
    ()
    .Name("grid")
    .Columns(columns => {
        columns.Bound(p => p.ID).Hidden();
        columns.Bound(p => p.Brand);
        columns.Bound(p => p.Size);
        columns.Bound(p => p.Type);
        columns.Bound(p => p.PartNumber);
        columns.Bound(p => p.Filename);
        columns.Bound(p => p.Description);
        columns.Bound(null).Title(" ").Width(50)
        .ClientTemplate(
            @Html.ActionLink(" ", "EditDoc", "Home", new { id=0 }, htmlAttributes: new { @class = "glyphicon glyphicon-pencil", @title = "Edit Description" }).ToHtmlString() + " | " +
            @Html.ActionLink(" ", "DeleteDoc", "Home", new { id=0 }, htmlAttributes: new { @class = "glyphicon glyphicon-trash", @title = "Delete Description \n WITHOUT CONFIRMATION" }).ToHtmlString()
            )
        ;

    })
    .Pageable()
    .Scrollable()
    .HtmlAttributes(new { style = "height:250px;" })
    .DataSource(dataSource => dataSource
    .Ajax()
    .PageSize(10)
    .Read(read => read.Action("BindingDocuments", "Home").Data("additionalData"))
    )
    )

1 Answer, 1 is accepted

Sort by
0
Raymond
Top achievements
Rank 1
Veteran
Iron
answered on 18 Oct 2024, 03:27 PM

I found the solution , need to set id="#=ID#"

Ray

Mihaela
Telerik team
commented on 21 Oct 2024, 08:21 AM

Hello Ray, 

Yes, to access the values of the respective fields in the ClientTemplate() option, you need to use the Kendo UI template syntax ("#=#" or "#:#").

Best,
Mihaela

Tags
Grid
Asked by
Raymond
Top achievements
Rank 1
Veteran
Iron
Answers by
Raymond
Top achievements
Rank 1
Veteran
Iron
Share this question
or