0

I am populating a dropdownlist via jquery and I can always get the selected dropdownItem like this:

Request.Form[EducationTypes.UniqueID]

The above code is performed on a normal postback to the server.

I can't figure out how to get all the items in the list when im at the server, not just the selected one...

Is this possible? and no I do not want to do a AJAX call to the server, i want to know if this can be done when doing a normal postback.

Thanks!

1 Answer 1

1

have <asp:HiddenField> in your page..

Then from javascript store any value you need as the HiddenField value, then from server-side you can access the hiddenfield value on postback..

From javascript you can set multiple values as comma-delimited and parse it on server.

Or for more complex data you can set value as json string from Javascript by serializing some object {} with

Sys.Serialization.JavaScriptSerializer.serialize(obj);

* you need to have a ScriptManager on page for this javascript to work

Then from code behind, Deserialize it to some class that matches the JSON structure

JavaScriptSerializer JSS = new JavaScriptSerializer();
JSS.Deserialize<SomeClass>(JsonString);
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.