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

[Solved] Grid column needs 2 values from model

2 Answers 92 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.
Bob
Top achievements
Rank 1
Bob asked on 29 Feb 2012, 05:51 PM
I am defining a grid column that is going to be an actionlink. I need to display a name (o => o.name), but I need to pass a filer_id (o => o.filer_id) instead of the name as a parameter to the method called by the actionlink. My problem is that I can only use one parameter per column, and I need two. If I could use (o => o) then Format(new ActionLink("{0}".name, "MyMethod", "MyController", new { filer_id = "{0}".filer_id }, null)) is what I want to do. Can you suggest a way to accomplish this?
Thanks in advance...

2 Answers, 1 is accepted

Sort by
0
Dadv
Top achievements
Rank 1
answered on 01 Mar 2012, 05:33 PM
Hi,

Look at this : http://demos.telerik.com/aspnet-mvc/grid/templatesserverside 

 columns.Template(c => {
            %> <%= Html.ActionLink(c.name, "MyMethod", "MyController", new { filer_id = c.filer_id }, null) %>
<%
           
});
I did it directly in this post, so not sure it will work fine directly but it is something like this

Regards,
0
Bob
Top achievements
Rank 1
answered on 07 Mar 2012, 05:11 PM
Thanks for responding! I have not yet become familiar with templates and how to use them. I will investigate them.
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Dadv
Top achievements
Rank 1
Bob
Top achievements
Rank 1
Share this question
or