Click here to Skip to main content
15,925,723 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

As i am new in this technology. i'm facing some obstacles.

i have code but that is not working :
@Html.DropDownListFor(m => m.CountryId, Model.CountryId,null, new { @onchange = "ChangeCulture();" })


i'm getting error over here : Model.CountryId,null,


please help me with the explaination

What I have tried:

@Html.DropDownListFor(m => m.CountryId, Model.CountryId,null, new { @onchange = "ChangeCulture();" })

@Html.DropDownListFor(m => m.CountryId, Model.LanguageSelector, new { onchange = "ChangeCulture();" })

@Html.DropDownList(a => a.CountryId, "Select Your Country", new { @class = "form-control", onchange = "clickMe()" })

@Html.DropDownListFor(a => a.CountryId, Model.CountryName,null, new {@onchange="clickMe()"});
Posted
Comments
Karthik_Mahalingam 29-Jun-16 5:41am    
what is the error
Er Daljeet Singh 29-Jun-16 8:24am    
Instead of writing "Model.CountryId,null" pass the list<selecteditem> and check whether your model have value of not


var listItems = new List<SelectListItem>()
{
new SelectListItem {Text = "Male", Value = "M"},
new SelectListItem {Text = "Female", Value = "F"}
};

@Html.DropDownListFor(m => m.Gender, listItems, string.Empty)

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