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

[Solved] invoke action method from row click in grid

4 Answers 156 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.
Justin Stuparitz
Top achievements
Rank 1
Justin Stuparitz asked on 25 Feb 2010, 07:26 PM
Hi all,

What's the easiest way to invoke a plan old action method when a user clicks a row in the grid.  I need to pass an id as well.  Don't want to do ajax here.  Just a plan old get.

thanks,
Justin

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 26 Feb 2010, 07:29 AM
Hello Justin Stuparitz,

The easiest way is to add a Template column which outputs an ActionLink:

<%  Html.Telerik().Grid(Model)
                 .Name("Grid")
                 .Columns(columns =>
                 {
                       columns.Add(o => o.OrderID);
                       columns.Add(o =>
                       {
                               %>
                                        <%= Html.ActionLink("Select", "Action", "Controller", new { id = o.OrderID }) %>
                               <%
                       }
                 })
                 .Render();
%>

I hope this helps,
Atanas Korchev
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
Justin Stuparitz
Top achievements
Rank 1
answered on 26 Feb 2010, 01:28 PM
Hi Atanas,

Thanks.  I'm aware of the template column with a link, but what I'm really trying to do is to add an onclick event for the entire row.

Is there any way to set this up in the grid without using jquery?

thanks,
Justin
0
Atanas Korchev
Telerik team
answered on 26 Feb 2010, 01:30 PM
Hi Justin Stuparitz,

No, there isn't. However using jQuery should not be such a problem in this case. What are your reasons against using jQuery?

Regards,
Atanas Korchev
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
Justin Stuparitz
Top achievements
Rank 1
answered on 26 Feb 2010, 01:36 PM
laziness.  that's all.
Tags
Grid
Asked by
Justin Stuparitz
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Justin Stuparitz
Top achievements
Rank 1
Share this question
or