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

Cannot set the width of of KendoUi Widgets Via CSS

2 Answers 51 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 10 Jul 2012, 05:07 AM
I am having some trouble setting the widths of KendoUi Widgets via either a css class or the style="width:  "

Below is a sample of some code from an MVC test project I am working. The date picker control is being rendered the entire width of the screen. The only way I can can get it to size correctly is by limiting the width of the parent element. Is this the the only way sizing of the widget can be controlled. Thanks.

<br><div><br>    <input id="dateTest" style="width: 200px" /></div><br>@Html.Telerik().ScriptRegistrar().OnDocumentReady(" $('#dateTest').kendoDatePicker();")


2 Answers, 1 is accepted

Sort by
0
Nilhan
Top achievements
Rank 1
answered on 30 Jul 2012, 11:20 AM
I'm having the same issue here. There's no clean way to set width of DatePicker.
The documentation provides no help at all regarding this.

Kendo team, please provide a solution!
0
Greg Horvath
Top achievements
Rank 1
answered on 30 Jul 2012, 02:50 PM
I figured out my issue. The kendoDatePicker function was getting called twice on the element. The second call to it removes all the width formating. If you only call it once it takes the width set via css or the style attribute. The problem was this line

@Html.Telerik().ScriptRegistrar().OnDocumentReady(" $('#dateTest').kendoDatePicker();")

It needed to be @{Html.Telerik().ScriptRegistrar().OnDocumentReady(" $('#dateTest').kendoDatePicker();")}
so it did not emit a second script registrar to the output.
Tags
General Discussions
Asked by
Greg
Top achievements
Rank 1
Answers by
Nilhan
Top achievements
Rank 1
Greg Horvath
Top achievements
Rank 1
Share this question
or