I am using mvc3 and I have a drop down list in my view.
@Html.DropDownListFor(m => m.State,
new SelectList(Model.StateList, "Value", "Text"))
Is there a way of setting the selected value in the View?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Extending on what Romias said, in your controller, set Model.State to whatever value you want. If you wanted ‘WI’, then Model.State should equal that.
Controller:
View: