Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am submitting books issued to students in form.for that i had kept one list box in that for issuing multiple books for same student,when i submit form. in post method i use form collection class to retrieve all values from form,when i check form collection key values it displays all fields id's but list box id is not showing in form collection key's.

What I have tried:

here the code which i used in view to display list box in the form
$("#FieldListTable").append('
<input class="addNewButton" style="float: left; margin-left: 0px;" type="button" value="Add" id="btnAdd" /><input class="addNewButton" style="float: left; margin-left: 0px;" type="button" id="btnRemove" value="Remove" />
BOOkS LISt
@Html.ListBox("LstSignInAuthority", Enumerable.Empty<SelectListItem>(), new { @id = "LstSignInAuthority", style = "width:200px;height:130px;" })
');
Posted
Comments
[no name] 19-Mar-16 8:24am    
It won't work. Because you are adding through javascript and @Html.ListBox is there in javascript code which is a MVC razor code. It won't render properly.

In order to resolve problem make div and display/hide based on your condition through javascript code.
Hussain Javed 21-Mar-16 1:11am    
I don't want to hide the list box in the form,then how it possible.I don't know how to do it.please guide me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900