Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to pass the selected value of a listbox contol to textbox control in mvc
Posted
Comments
BillWoodruff 9-Nov-15 8:53am    
what have you tried so far ?

1 solution

Read this: ASP.Net MVC – How to create a ListBox?[^]

Here on Index method, you'd be getting the selected value from the listbox. Instead here, store your selected value in ViewBag and load that value in the view for the textbox.

Another approach is, bind the selected value to the model and pass it to the view. And use @Html.TextBoxFor() to render the value.


-KR
 
Share this answer
 

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