asp.net mvc - webgrid return null when edit -


i try create webgrid editable user.. when click row of webgrid, can edit user username but, why value of username null when send controller webgrid javascript? web grid

<div class="form-box">     <div>         <input  style="width:180px;" type="button" title="adduser" value="add new users"  onclick="location.href='@url.action("newuser", "user")    '" />     </div>     <br />     @if (grid != null)     {         @grid.gethtml(         tablestyle: "grid",         headerstyle: "head",                 alternatingrowstyle: "alt",         firsttext: "<< first",         previoustext: "< prev",         nexttext: "next >",         lasttext: "last >>",         mode: webgridpagermodes.all,         columns: grid.columns(             grid.column(header:"login name",format:(item) => item.username),             grid.column(header: "full name", format: (item) => item.fullname),             grid.column("email"),             grid.column("active"),             grid.column("master")         )         )     }     </div> @section scripts { <script type="text/javascript">     $(function(){         $('tbody tr').live('hover', function(){             $(this).toggleclass('clickable');         }).live('click', function(){             var username = $(this).find('td:first').text();             location.href = '/user/edituser/' + username;           });      }); </script> } 

and controller

public actionresult user()         {             list<user> getuser = _userservice.showuser(_hotelid);             listuserviewmodel model = userbuilder.build(getuser);              return view(model);         }  public actionresult edituser(string username)         {             list<user> userviewmodel = _userservice.userviewmodel(username, _hotelid);             if (userviewmodel.count == 0)             {                 return redirect("httpnotfound");             }             else             {                 listuserviewmodel model = userbuilder.build(userviewmodel);                 return view(model.listuser.firstordefault());             }         } 

can 1 tell me , me?

i think problem is,use val insted of text.

<script type="text/javascript">     $(function(){         $('tbody tr').live('hover', function(){             $(this).toggleclass('clickable');         }).live('click', function(){             var username = $(this).find('td:first').val();             location.href = '/user/edituser/' + username;           });      }); </script> 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -