There is a .Height property for the DropDownList, but no .Width property. Why not? The only way I've found this (see below) - and that took some rooting through other forum postings:
Could not find ANY information on this in the documentation. It may be there, but it's not obvious.
Is there a better way to set width? Again, seems like this should be a fairly normal property to set.
@(Html.Kendo().DropDownList()
.Name("companyGroup")
.DataTextField("Text")
.DataValueField("Value")
... removed for brevity
.HtmlAttributes(new { style = "width:250px"})
)
Could not find ANY information on this in the documentation. It may be there, but it's not obvious.
Is there a better way to set width? Again, seems like this should be a fairly normal property to set.
5 Answers, 1 is accepted
0
Hello Mark,
Georgi Krustev
the Telerik team
The height property defines the maximum height if the popup element and not the height of the widget itself. The way you set the width of the widget is just fine, because the Kendo UI DropDownList wrapper renders an input element with the correct attributes and then the Kendo DropDownList is initialized from it.
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!
0
AkAlan
Top achievements
Rank 2
answered on 17 Dec 2013, 08:08 PM
Trying to set both Width and Height but when adding Height to the mix, it overrides the width setting. How can I set both?
0
Hello Alan,
Here is a simple jsBin demo, which shows how to achieve this. You can achieve the same behavior using the Kendo wrapper for ASP.NET MVC.
Regards,
Georgi Krustev
Telerik
Here is a simple jsBin demo, which shows how to achieve this. You can achieve the same behavior using the Kendo wrapper for ASP.NET MVC.
Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
AkAlan
Top achievements
Rank 2
answered on 18 Dec 2013, 08:23 PM
Hi Georgi Krustev, the example sets the width of the entire dropdown. I guess what I meant to ask about is how to set the dropdown list width. I have cloned your jsBin here and provided a working example of how to set the List width different from the Dropdown width. This comes in handy when using a template in the dropdown to show multiple columns in the list but only the selected item in the dropdown. Is there a better way to achieve this behavior all in one statement? Also there really should be something in the basic documentation about how to achieve this rather common functionality. Thanks.
0
Hello again Alan,
Thank you for the clarification and for the updated jsBin demo. Currently, this is the only suggested approach, which can be used to define popup width different than its anchor. This is documented here. I will suggest you open a user voice discussion on the subject. Thus we will gather community feedback and will be able to determine how to implement it.
Regards,
Georgi Krustev
Telerik
Thank you for the clarification and for the updated jsBin demo. Currently, this is the only suggested approach, which can be used to define popup width different than its anchor. This is documented here. I will suggest you open a user voice discussion on the subject. Thus we will gather community feedback and will be able to determine how to implement it.
Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!