asp.net mvc - Pass html datalist value to Html.Action -
i'm creating html form lists line items 1 organization need mapped on. idea take id of selected option, , pass action via html.action. code have far;
<table class="table"> <tr> <th> @html.displaynamefor(model => model.newid) </th> <th> @html.displaynamefor(model => model.oldserviceid) </th> <th> @html.displaynamefor(model => model.description) </th> <th> @html.displaynamefor(model => model.avg) </th> <th> @html.displaynamefor(model => model.count) </th> <th> @html.displaynamefor(model => model.acquisitionid) </th> <th></th> </tr> @foreach (var item in model) { <tr> <td> @* i'm stuck *@ <form action=@html.action("update", new { linemappingid = @item.linemapid, newid = /*what goes here?*/ }) method="post" onsubmit="return updateform()" id="@item.linemapid"> <input list="servicelist" name="servicelist"> <datalist id="servicelist"> @foreach (var serv in viewbag.servicelist) { @* pass id value here html.action *@ <option value="@serv.serviceid - @serv.servicedesc" id="@serv.serviceid">@serv.serviceid - @serv.servicedesc</option> } </datalist> <input type="submit" value="update" /> </form> </td> <td> @html.displayfor(modelitem => item.oldserviceid) </td> <td> @html.displayfor(modelitem => item.description) </td> <td> $@html.displayfor(modelitem => item.avg) </td> <td> @html.displayfor(modelitem => item.count) </td> <td> @html.displayfor(modelitem => item.acquisitionid) </td> </tr> } </table>
Comments
Post a Comment