1

How can I set dropdown value from client side, I'm using countries.js file to load countries and state, Since It is loaded from client side on grid row selection (for updation) I'm unable to load country and state from server side.This is the link https://bdhacker.wordpress.com/2009/11/21/adding-dropdown-country-state-list-dynamically-into-your-html-form-by-javascript/

dropdownlist.SelectedIndex = dropdownlist.Items.IndexOf(dropdownlist.Items.FindByValue(value));

The dropdown is populated from client side,

1

1 Answer 1

1

I'm not sure if I understand your question. According to your first sentence, these lines might help you in this case.

To add an option to your select;

$('#country2').append("<option value='new'>new</option>");

and select an option.

$("#country2 option[value='france']").prop('selected','selected');

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.