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

How to add CSS class to dropdown list server wrapper?

1 Answer 2509 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 09 Sep 2014, 08:55 PM
Hi, I'm wanting to put a css class on dropdownlist but unsure how to do.  I have a "width100percent" css class, but just doing inline styles at moment.

​ @(Html.Kendo().DropDownListFor(m => m.SecurityQuestion1Id)
 .DataTextField("Item2")
 .DataValueField("Item1")
 .BindTo(Model.SecurityQuestionOptions)
 .HtmlAttributes(new { style = "width:100%;" })
 )

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 10 Sep 2014, 07:06 AM
Hi Bob,

For this requirement you can use the HtmlAttributes method: 
@(Html.Kendo().DropDownList()
  //....
  .HtmlAttributes(new {@class = "customClass"})
)

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