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

DropDownList Width in MVC

3 Answers 1525 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 2
Ian asked on 22 Jul 2013, 10:21 PM
In MVC, can the DropDownList have its width changed?

I've seen posts on how to do it on the client, but would rather have it at the MVC level.

3 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 23 Jul 2013, 12:44 PM
Hello Ian,

You could change the Kendo UI for ASP.NET MVC DropDownList's width using the following code snippet:

// get reference to the DropDownList
var dropdownlist = $("#ddl").data("kendoDropDownList");
// set width of the DropDownList list
dropdownlist.list.width(500);
  Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ian
Top achievements
Rank 2
answered on 23 Jul 2013, 08:36 PM
Thank you Lliana,

Although that does correctly resize the list part of the drop down, it doesn't resize the dropdown itself. See attachment.

Is there a way to do this?

Ian
0
Iliana Dyankova
Telerik team
answered on 24 Jul 2013, 06:51 AM
Hello Ian,

In order to achieve this you could use the HtmlAttributes method. For working example take a look at this online demo.

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
Ian
Top achievements
Rank 2
Answers by
Iliana Dyankova
Telerik team
Ian
Top achievements
Rank 2
Share this question
or