asp.net mvc - set ActionLink routeValues dynamically -


i'm working on reading value textbox (let sam):

 <%=  html.textbox("name")%> 

and on click of action link:

<%: html.actionlink("edit","edit",routevalues %>  

i need route (this url should open) /edit/sam

how can that?

since aren't using route values above , instead name of textbox can create link name textbox "name" (if isn't already) via html attributes new {id="name"} (for ex) can jquery value , append it

 <a href="#" onclick="window.location.href='@url.action("edit", "edit")' + $('#name').val()">edit</a> 

you use html above , attach onclick event handler jquery well.

   $(document).ready(function() {         $("#name").click(function() {             window.location.href= $('#idoflinkhref').attr('href') + '/' +  $('#name').val()         });     }); 

something anyways off top of head.

there lot of ways - these couple ideas.


Comments