Hi All,
I have the following in one of my pages:
it renders and populates from the server no problem and it has valid values.Code:@Html.DropDownListFor(model => model.OccupationID, new SelectList(Model.Occupations, "Value", "Text"), "-- Select --", new { @class = "EnabledDropDownList400" })
Now rather than go all the way to the server, under 1 condition when the user selects a value from another dropdown I need to set a default value in the above dropdown. I can see that the value exists in my dropdown, but it just will not set.
My JQuery Function to set the default is entered at the correct time.
I have tried the following to NO avail:
if I perform a view source on the page I have:Code:$("#OccupationID option[text='Clerical and Managerial'] ").attr("selected",true); $("#OccupationID option[text='Clerical and Managerial'] ").attr("selected","selected");
Code:<select class="EnabledDropDownList400" data-val="true" data-val-number="The field Occupation must be a number." id="OccupationID" name="OccupationID"><option value="">-- Select --</option> <option value="8000000007540730">Abattoir</option> <option value="8000000007540734">Abrasive Wheel Manufacturers</option> <option value="8000000007540754">Advertising contractors i), i.e.boardings</option> <option value="8000000007540758">Advertising handbill ii)distribution only</option> <option value="8000000007540762">Advertising ii) agencies</option> <option value="8000000007540766">Aerated Water and Soft Drinks</option> <option value="8000000007541219">Clerical and Managerial</option>......


Reply With Quote