This is a migrated thread and some comments may be shown as answers.

set dropdownlist value client side

1 Answer 462 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 21 Dec 2012, 07:15 PM
Hi, we're using the FormDecorator and I notice on the front end the dropdownlist renders as a div with spans instead of a traditional html select list.

When I try to use jquery to set the selected value after the control renders it doesn't change. I'm guessing because this is technically not a select list anymore.

Is there any work around to this?

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 25 Dec 2012, 12:49 PM
Hello Brian,

Handling elements of type select are quite complex and not all their attributes can be monitored, especially in the way jQuery changes them ($("#theSelect").val(newIndex)). What I can suggest is using simple JavaScript to set the new selected item:
$get("<%=ddl1.ClientID %>").selectedIndex = 2;

I am also attaching here a simple page that shows this in action.

Kind regards,
Marin Bratanov
the Telerik team
Explore the entire set of ASP.NET AJAX controls we offer here and browse the myriad online demos to learn more about the components and the features they incorporate.
Tags
FormDecorator
Asked by
Brian
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or