i´m usign ASP.net MVC 3 Razor C# and i´m working with webGrid, In this WebGrid I put a list of links, when i click one of those links i get this URL:
http://localhost:50410/?SelectedRow=4 i want to put the 4 into a variable on my controller so i can know wich link was selected. I hope someone can help me please.
moy7
Member
52 Points
86 Posts
Obtain data from the url
Feb 21, 2012 09:30 PM|LINK
Hello here is my problem:
i´m usign ASP.net MVC 3 Razor C# and i´m working with webGrid, In this WebGrid I put a list of links, when i click one of those links i get this URL:
http://localhost:50410/?SelectedRow=4 i want to put the 4 into a variable on my controller so i can know wich link was selected.
I hope someone can help me please.
giop
Member
378 Points
81 Posts
Re: Obtain data from the url
Feb 21, 2012 09:59 PM|LINK
Your action must have a parameter named, SelectedRow, int or string type. MVC will parse the query string following your action parameters.
In your url : http://localhost:50410/Action?SelectedRow=4
Hope this help.
Please Mark as Answer if it helps :)
moy7
Member
52 Points
86 Posts
Re: Obtain data from the url
Mar 28, 2012 05:47 PM|LINK
Here is the solution for th problem:
@if (grid.HasSelection)
{
@Html.ActionLink("namelink","yourview", new { index =grid.SelectedIndex })
}