.HtmlAttributes(new { @style = "display:inline;width:300px" })
Thanks for any advice you can give.
4 Answers, 1 is accepted
The DatePicker by default is an inline-block element, so it is able to exist on the same line as other elements or DatePickers. Here is a demo, which shows this:
http://demos.telerik.com/aspnet-mvc/datepicker
Setting display:inline to the DatePicker will surely not work, because there is a block element inside, which will make the component fall on a new line.
All the best,
Dimo
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!


Here's my code for the label and datepicker.
<
p
>
@Html.LabelFor(x => x.ProjectionPolicy.ClaimPaymentDate)
@(Html.Telerik().DatePicker()
.Name("ProjectionPolicy.ClaimPaymentDate")
.ShowButton(true)
.Value(Model.ProjectionPolicy.ClaimPaymentDate)
)
</
p
>
Notice that the datepicker is clearly inside the paragraph. The source reflects that.
<
p
>
<
label
for
=
"ProjectionPolicy_ClaimPaymentDate"
>Claim Payment Date</
label
>
<
div
class
=
"t-widget t-datepicker"
><
div
class
=
"t-picker-wrap"
><
input
class
=
"t-input"
id
=
"ProjectionPolicy_ClaimPaymentDate"
name
=
"ProjectionPolicy.ClaimPaymentDate"
/><
span
class
=
"t-select"
><
span
class
=
"t-icon t-icon-calendar"
title
=
"Open the calendar"
>Open the calendar</
span
></
span
></
div
></
div
>
</
p
>
However, using inspector on the page shows the datepicker *outside* the paragraph.
<
p
>
<
label
for
=
"ProjectionPolicy_ClaimPaymentDate"
>Claim Payment Date</
label
>
</
p
>
<
div
class
=
"t-widget t-datepicker"
>
<
div
class
=
"t-picker-wrap"
>
<
input
id
=
"ProjectionPolicy_ClaimPaymentDate"
class
=
"t-input"
name
=
"ProjectionPolicy.ClaimPaymentDate"
autocomplete
=
"off"
>
<
span
class
=
"t-select"
>
<
span
class
=
"t-icon t-icon-calendar"
title
=
"Open the calendar"
>Open the calendar</
span
>
</
span
>
</
div
>
</
div
>
<
p
></
p
>
Can you think of any reason for this to happen? I have to assume some javascript is creating or moving elements around, but that's just a suspicion? But something is causing the elements to move outside the paragraph other than my code, unless I'm just totally missing something on my end. Thoughts?
A reasonable explanation for the observed phenomenon is that <div>s are not allowed inside <p>s - this is not valid HTML code.
Greetings,
Dimo
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!