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

[Solved] Can't get action link working with data bound parameter and client template

4 Answers 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Matthew
Top achievements
Rank 1
Matthew asked on 18 Aug 2011, 09:32 PM
In my ajax MVC grid I have the following in my detail view client template:

    <#= Id #>
    <%: Html.ActionLink("Download Last Log", "DownloadLastTestRunLogFile", "AutomationRequests", new { requestId = "<#= Id =>" }, new { @class = "button" })%> &nbsp;

The first <#= Id #> is correctly binding to the Id number, however the data binding is not working in the requestId parameter.  This is causing the template to contain the following URL: http://localhost:59269/AutomationRequests/DownloadLastTestRunLogFile?requestId=%3C%23%3D%20Id%20%3D%3E

How can I get the action link's requestId parameter to data bind?

4 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 19 Aug 2011, 07:19 AM
Hi Matthew,

In this case you should manually decode the generated URL similar to the following:

Server.UrlDecode(Html.ActionLink("Download Last Log", "DownloadLastTestRunLogFile", "AutomationRequests", new { requestId = "<#=Id#>" }, new { @class = "button" }).ToHtmlString())

Also note that there is an syntax error in the template.
This 
new { requestId = "<#= Id =>" }
should be
new { requestId = "<#= Id #>" }

Regards,
Rosen
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items

0
Matthew
Top achievements
Rank 1
answered on 19 Aug 2011, 02:22 PM
Ok that makes sense.

Unfortunately, after further evaluation it seems like Telerik grids are not up to the quality I need.  I am requiring a grid that is constantly updated every 15-30 seconds, and unfortunately Telerik grids cannot handle refreshes very well.  Even when data doesn't change, a refresh causes my selection to be unselected, and the detail view collapsed.  Other javascript grids I have used are smart enough to know when data comes in, that the record is already in the grid and it just needs to update it's data, not wipe all current data and recreate all the records like Telerik's grids seem to do.

0
Rosen
Telerik team
answered on 19 Aug 2011, 04:01 PM
Hi Matthew,

Although, not built-in, persisting selected state and detailView's expanded state can be achieved with few lines of JavaScript. I have attached a small sample which demonstrates a possible implementation.
I hope this helps.

Regards,
Rosen
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Matthew
Top achievements
Rank 1
answered on 19 Aug 2011, 04:28 PM
Oh that script works perfectly.  That's easy enough.

Thanks!
Tags
Grid
Asked by
Matthew
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Matthew
Top achievements
Rank 1
Share this question
or