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

[Solved] can't set/search default dropdown value

1 Answer 204 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 23 Feb 2013, 10:57 PM
I'm using the following

.DropDownListFor(m => m.countryId)
            .DataSourceAction("GetSomething")
            .DataSourceController("SomethingMethod")
            .IsEnabled(true)
            .Name("Something")
            .OptionLabel(this.LocalResources("OptionSelect"))
            .ServerFiltering(true))

I'm trying to use the search / select functions on the dropdown but when I do a console log of the dropdownlist obj I don't see it in there

e.extend.init {element: p.fn.p.init[1], _events: Object, options: Object, template: function, ul: p.fn.p.init[1]…}
  1. _arrow: p.fn.p.init[1]
  2. _busy: null
  3. _current: p.fn.p.init[1]
  4. _events: Object
  5. _fetch: false
  6. _focused: p.fn.p.init[1]
  7. _inputWrapper: p.fn.p.init[1]
  8. _old: ""
  9. _oldIndex: 0
  10. _refreshHandler: function (){return a.apply(c,e.concat(k.call(arguments)))}
  11. _requestStartHandler: function (){return a.apply(c,e.concat(k.call(arguments)))}
  12. _text: function anonymous(d) {
  13. _touchScroller: false
  14. _value: function anonymous(d) {
  15. _word: ""
  16. dataSource: o.extend.init
  17. element: p.fn.p.init[1]
  18. list: p.fn.p.init[1]
  19. options: Object
  20. popup: e.extend.init
  21. selectedIndex: 0
  22. span: p.fn.p.init[1]
  23. template: function anonymous(data) {
  24. ul: p.fn.p.init[1]
  25. wrapper: p.fn.p.init[1]
  26. __proto__: b
  27. var dropdownlist = $("#country").data("kendoDropDownList"); dropdownlist.select("United States");
    TypeError: Object United States has no method 'hasClass'
    1. arguments: Array[2]
    2. get message: function () { [native code] }
    3. get stack: function () { [native code] }
    4. set message: function () { [native code] }
    5. set stack: function () { [native code] }
    6. type: "undefined_method"
    7. __proto__: Error

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 25 Feb 2013, 08:39 AM
Hello Phil,

 
The DropDownList widget has select method, but it accepts Integer, DOM element and predicate. It does not support string parameter. I will suggest check the documentation for more information.

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
Phil
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or