This is a migrated thread and some comments may be shown as answers.

Kendo Grid Hyperlink is not working

3 Answers 376 Views
Grid
This is a migrated thread and some comments may be shown as answers.
tam
Top achievements
Rank 1
tam asked on 14 May 2015, 05:22 PM

 

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>

3 Answers, 1 is accepted

Sort by
0
tam
Top achievements
Rank 1
answered on 14 May 2015, 11:07 PM

 

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());

0
tam
Top achievements
Rank 1
answered on 14 May 2015, 11:08 PM

 

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());

0
Dimiter Madjarov
Telerik team
answered on 15 May 2015, 11:14 AM

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
Tags
Grid
Asked by
tam
Top achievements
Rank 1
Answers by
tam
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Share this question
or