TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
raja ramesh
NA
50
108.8k
How to select html dropdownlist default value in mvc3 using jquery
Jan 10 2012 8:49 AM
Hi,
I am working on Asp.net mvc3
My view part
<select name="" class="styled" id="countryDropDown" >
@foreach(var country in HttpContext.Current.Cache.Get("Countries") as List<Country>){
<option value="@country.Id" >@country.Name</option>
}
</select>
<select name="" class="styled" id="stateDropDown" > </select>
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
Reply
Answers (
3
)
QR Code in Crystal report
how we can add outlinne border to repeater