asp.net mvc - Passing Textbox Value using Html.ActionLink -
I have a table that lists the products as well as displays a volume text box and an HTML.ActionLink. Each volume text box has a unique ID received from the product ID. I think it should be simple, but I can not find out how to get value in the respective controller box is given to my controller when the user clicks on the link. My code is down and any help is appreciated.
& lt;% foreach (Miscellaneous items in the model) {%> & Lt; TR & gt; & Lt; TD & gt; & Lt;% = Html.Encode (item.Id)% & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt;% = Html.Encode (item description)% & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt;% = Html.Encode (string.format ("$ {0: F}", items.cast))% & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt;% = Html.TextBox (string.format ("volume {0}", item.id), "0")% & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt;% = Html.ActionLink ("Add", "Add", new {id = item.Id, quantity = "I want volume here?"}}}}% & Gt; & Lt; / TD & gt; & Lt; / TR & gt;
I think what you want:
< Code> & lt;% = Html.TextBox (string.format ("item [{}} quantity.", Item.id), "0")% & gt;
For more information on this, take a look at the following Scott Hanselman blog post:
Also See this blog post from Steve Sanderson will allow you to edit a single item:
Edit a variable-length list of items in ASP.NET MVC
Comments
Post a Comment