Kendo Grid Hyperlink is not working

4 posts, 0 answers
  1. tam
    tam avatar
    13 posts
    Member since:
    Apr 2015

    Posted 14 May 2015 Link to this post

     

    Hello,

    Please let me know what I am doing wrong.  Thank you.

    I go the error from hyperlink:

    Unhandled exception at line 526, column 66 in Function code

    0x800a1391 - JavaScript runtime error: 'PersonId' is undefined

    If there is a handler for this exception, the program may be safely continued.

     

    <script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<CustomerServicesApplication.Models.DetailsViewModel>()
    .Name("grid_#=InternalId#")
    .Columns(columns =>
    {
    columns.Bound(o => o.PrimaryApplication).Width(110);
    columns.Bound(o => o.PersonId).ClientTemplate(@Html.ActionLink("#=PersonId#", "AdvancedSearch", new { PersonId = "#=PersonId#" }).ToHtmlString()).Width(110);

    columns.Bound(o => o.ACESId).Width(110);
    columns.Bound(o => o.Removed).Width(200);
    columns.Bound(o => o.SeekingCoverage).Width(200);
    columns.Bound(o => o.FirstName).Width(200);
    columns.Bound(o => o.MiddleName).Width(200);
    columns.Bound(o => o.LastName).Width(200);
    columns.Bound(o => o.SSN).Width(200);
    columns.Bound(o => o.DateOfBirth).Width(200);
    columns.Bound(o => o.Gender).Width(200);
    columns.Bound(o => o.Age).Width(200);
    columns.Bound(o => o.LastYearTax).Width(200);
    columns.Bound(o => o.ThisYearTax).Width(200);
    columns.Bound(o => o.NextYearTax).Width(200);
    })
    .DataSource(dataSource => dataSource
    .Ajax()
    .PageSize(10)
    .Read(read => read.Action("MainSearch_Details", "CustomerServices", new { internalId = "#=InternalId#" }))
    )
    .Pageable()
    .Sortable()
    .ToClientTemplate()
    )
    </script>

  2. tam
    tam avatar
    13 posts
    Member since:
    Apr 2015

    Posted 14 May 2015 Link to this post

     

    For nested grid, I added \\#=PersonId\\# for it to work...

     

    columns.Bound(o => o.PersonId).Width(110).ClientTemplate(Html.ActionLink("\\#=PersonId\\#", "AdvancedSearch", "CustomerServices", new { personId = "\\#=PersonId\\#" }, null).ToString());

  3. tam
    tam avatar
    13 posts
    Member since:
    Apr 2015

    Posted 14 May 2015 Link to this post

     

    for nested grid, I have to add \\ for it to work...

    columns.Bound(o => o.PersonId).Width(110).ClientTemplate(Html.ActionLink("\\#=PersonId\\#", "AdvancedSearch", "CustomerServices", new { personId = "\\#=PersonId\\#" }, null).ToString());

  4. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2311 posts

    Posted 15 May 2015 Link to this post

    Hello tam,

    This is correct. When a template is used inside detail template, the hash symbols (#) should be escaped, so that the template is skipped by the master Grid and evaluated by the detail Grid.

    Regards,
    Dimiter Madjarov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top