Hi,
I am working on Asp.net mvc3
My view part
I have written following code to cascading dropdownlists
opulateStatesDropDown()
{
//code for populate statedropdowlist and it is working
}
$("#countryDropDown").val("@ViewBag.CountryID"); //This line is working
if ($("#countryDropDown").val() != null) {
PopulateStatesDropDown();
$("#stateDropDown").val("@ViewBag.StateID"); //This is not working
control Action
ViewBag.CountryID = Country.Id;
ViewBag.StateID = State.Id;
I have written above code for select default values and its working for Countrydropdownlist but its not working for statedropdownlist.
Can you tel me anyone where I have done mistake ?
Thank you in advance
How to select html dropdownlist default value in mvc3 using jquery
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 10, 2012, 7:43 PM EST
Try Atteched code.
hope this help.
raja ramesh46 reputationPosted Jan 11, 2012, 7:41 PM EST
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 11, 2012, 8:18 PM EST
sorry,
please rename extension
from zip to zipx and try.