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

DatePicker does not seem to format using class in InputHtmlAttributes

3 Answers 127 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Frode Solheim
Top achievements
Rank 1
Frode Solheim asked on 30 Aug 2010, 01:32 PM
Hi.
The code below does not format the DatePicker with the specified width of 200px as in my CSS class shown below. If I use e.g. a CurrencyTextBoxFor with the same class as for the DatePicker it works correctly, but the DatePicker does not format.

<% Html.Telerik().DatePickerFor(o => o.StartDato)
                 .Name("StartDato")
                 .InputHtmlAttributes(new { @class = "input" })
                 .Format("dd. MMM yyyy")
                 .ButtonTitle("Dato")
                 .Render(); %>

But, if I specifies the attribute directly like in the code below it formats correctly. Is this a bug or am I understanding this wrong?

<% Html.Telerik().DatePickerFor(o => o.StartDato)
                 .Name("StartDato")
                 .InputHtmlAttributes(new { style = "width: 200px;" })
                 .Format("dd. MMM yyyy")
                 .ButtonTitle("Dato")
                 .Render(); %>

Below is my CSS class.

.input
{
    width: 200px;
}

The version is: Telerik_Extensions_for_ASPNET_MVC_2010_2_825




3 Answers, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 30 Aug 2010, 02:51 PM
Hello Frode Solheim,

Your specificity of the selector is weaker then the default one. You can try this:

.t-datepicker .input
{
   width: 200px;
}

Greetings,
Hristo Germanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stef Heyenrath
Top achievements
Rank 1
answered on 02 Aug 2011, 09:45 AM
Shouldn't it be:

.t-datepicker .t-picker-wrap .t-input
{
   width: 200px;
}
0
Dimo
Telerik team
answered on 02 Aug 2011, 11:55 AM
Hello all,

Actuially, it does not make sense to modify the width of the textbox, because it is wrapped inside other elements that have a preset width in telerik.common.css. The textbox has a 100% width style and its size depends on its parent elements' width. So a lot cleaner approach is to modify the width of the wrapper element (i.e. div.t-datepicker).

All the best,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Tags
Date/Time Pickers
Asked by
Frode Solheim
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Stef Heyenrath
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or