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

DropDownList .Value() method

1 Answer 269 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Veselin
Top achievements
Rank 1
Veselin asked on 13 May 2013, 07:09 AM
Why the DropDownList .Value() method changes the value of the <input> element, but not displaying it. I saw that it displays some value in a <span> element that I don't know how to change. When I use DropDownListFor(x => x.UserName) I want my default value to be what I have in the Model. My question is how to set the default value of a DropDownList?

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 14 May 2013, 09:57 AM
Hello Veselin,

 
The MVC wrapper for Kendo DropDownList widget, renders input element with the selected value. If the widget is not bound then you will not be able to see the selected text. In other words if the autoBind option is set to false, then the widget will not be bound and thus will not show the selected text. In order to achieve your goal you can either set the AutoBind(true), which is the default value, or set the text and value of the widget. I am not exactly sure what is the problem with strongly-typed extension, but you can check here.

Greetings,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
DropDownList
Asked by
Veselin
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or