Rajesh
Rajesh

Reputation: 2502

Drop down change event populate value

Table

Id(Key)  Description(Value)             Car

1         scott                         BMW

2         john                          ford

Id and Description will be Key value pair to Dropdown. I have to display Car name in textbox based on the Id selected.

What will be the best way to achieve this.

Is there a way to avoid call to server for every dropdown event change.

Upvotes: 1

Views: 161

Answers (1)

suff trek
suff trek

Reputation: 39767

You can store "Car" as a custom client-side attribute of ListItem element of the dropdown (it will become an attribute of <option> element when list item is rendered.

On client-side on onchange event you can retrieve that attribute and display it in the textbox.

Upvotes: 2

Related Questions