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

[Solved] What do I need to do in order to query HtmlAttributes values on my DropDownList?

1 Answer 24 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gene
Top achievements
Rank 1
Gene asked on 25 Jul 2012, 03:05 PM
What do I need to do in order to query HtmlAttributes values on my DropDownList?  I know how to do this via jQuery, but what is the proper way to query the HtmlAttributes? How do I query these?

@(Html.Telerik().DropDownListFor(model => model.BookingOfficeIdNew)
                         .Name("BookingOfficeIdNew")
                         .HtmlAttributes(new
                             {
                                 @class = "PropertyProposedValueSelect",
                                 @delta = Model.BookingOfficeIdNew,
                                 @container = "BookingOfficeContainer",
                                 @updateFlag = "BookingOfficeIdChanged",
                                 @deltaValue = "BookingOfficeIdOld",
                                 @newValue = "BookingOfficeIdNew",
                                 @newText = "BookingOfficeNameNew"
                             })
                         .ClientEvents(events => events
                           .OnChange("SelectListValueUpdated")
                             .OnLoad("OnDropDownListLoad")
                             .OnOpen("OnDropDownListOpen")
                           )
                         .BindTo(Model.BookingOfficeIdChanged ? @Html.ToSelectList(Model.BookingOfficeNameNew, Model.BookingOfficeIdNew, true) : ((SelectListItem)ViewData["DefaultSelectListPrompt"]).ToSelectList(true))
                         .SelectedIndex(0)
                         .DataBinding(binding => binding.Ajax().Select("RraOfficeSelectListWithPrompt", "Revision"))
                         )

1 Answer, 1 is accepted

Sort by
0
Gene
Top achievements
Rank 1
answered on 25 Jul 2012, 05:22 PM

EDIT/Answer: I opted for selecting the parent container, using the proper class name; as the Telerik DropDownList extension generates an input element with id = "BookingOfficeIdNew", whose parent div container has class ".t-dropdown".

$("#BookingOfficeIdNew").parent(".t-dropdown").attr("whatever")

Tags
ComboBox
Asked by
Gene
Top achievements
Rank 1
Answers by
Gene
Top achievements
Rank 1
Share this question
or