Obtain data from the url http://forums.asp.net/t/1772228.aspx/1?Obtain+data+from+the+url+Wed, 28 Mar 2012 17:47:54 -040017722284843888http://forums.asp.net/p/1772228/4843888.aspx/1?Obtain+data+from+the+url+Obtain data from the url <p><strong>Hello here is my problem:</strong><br> <br> <strong>i´m usign ASP.net MVC 3 Razor C#&nbsp; 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:</strong><br> <br> <strong>http://localhost:50410/?SelectedRow=4&nbsp;&nbsp;&nbsp; i want to put the 4 into a variable on my controller so i can know wich link was selected.</strong><br> <strong>I hope someone can help me please.<img src="http://forums.asp.net/scripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif" alt="Laughing" title="Laughing" border="0"> &nbsp;</strong></p> 2012-02-21T21:30:03-05:004843910http://forums.asp.net/p/1772228/4843910.aspx/1?Re+Obtain+data+from+the+url+Re: Obtain data from the url <p>Your <span style="text-decoration:underline">action</span> must have a parameter named, <strong>SelectedRow</strong>, int or string type. MVC will parse the query string following your action parameters.</p> <pre class="prettyprint">public ActionResult Action(int SelectedRow)</pre> <p>In your url :&nbsp;<strong>http://localhost:50410/Action?SelectedRow=4&nbsp;</strong></p> <p><strong><br> </strong></p> <p><strong>Hope this help.</strong></p> <p><strong><br> </strong></p> 2012-02-21T21:59:33-05:004904643http://forums.asp.net/p/1772228/4904643.aspx/1?Re+Obtain+data+from+the+url+Re: Obtain data from the url <p>Here is the solution for th problem:</p> <p>@if (grid.HasSelection)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @Html.ActionLink(&quot;namelink&quot;,&quot;yourview&quot;, new { index =grid.SelectedIndex })<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p> 2012-03-28T17:47:54-04:00