Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net mvc 3 razor. navigate to view on table tr click

I have users list table how i can navigate on url: "../users/showprofile?userid="

I want to make table when user clicks on table row navigate on current user profile

Thanks

like image 649
Irakli Lekishvili Avatar asked May 06 '12 12:05

Irakli Lekishvili


1 Answers

Without using jQuery, assuming you're in a foreach loop like something below, just change the tr definition to be something like:

@foreach (var user in Model.Users) {     <tr onclick="location.href = '@(Url.Action("ShowProfile", "Users", new { userId = user.UserId }))'">     //rest of your markup for that table row     </tr> } 
like image 68
mattytommo Avatar answered Oct 20 '22 02:10

mattytommo