Hi!
By default RadDatePicker displays its Calendar below DateInput, but I need to display it above. In the help I've found how to implement it using JavaScript, and it works in general. A problem comes when I disable and then enable RadDatePicker with JavaScript. After that when I click on DatePopupButton the Calendar appears for a short moment and then disappears.
Here is my aspx-page code:
It's cs-file:
In the beginning the RadDatePicker control is enabled, and click on DatePopupButton opens Calendar properly. If I select option1 or option3 the RadDatePicker becomes disabled. Then I select option3, and the RadDatePicker becomes enabled again, but after clicking on DatePopupButton the Calendar just appears and then disappears in a moment.
Why is that and how can I fix it?
Thank you
By default RadDatePicker displays its Calendar below DateInput, but I need to display it above. In the help I've found how to implement it using JavaScript, and it works in general. A problem comes when I disable and then enable RadDatePicker with JavaScript. After that when I click on DatePopupButton the Calendar appears for a short moment and then disappears.
Here is my aspx-page code:
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
telerik:RadCodeBlock
ID
=
"radCodeBlock"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function enableDTPicker(isEnabled)
{
var dtStartDate = $find("<%=dtStartDate.ClientID %>");
if (dtStartDate != null)
{
dtStartDate.set_enabled(isEnabled);
dtStartDate.get_calendar().set_enabled(isEnabled);
dtStartDate.get_popupButton().disabled = !isEnabled;
}
}
function PopupOpen()
{
var picker = $find("<%= dtStartDate.ClientID %>");
var textBox = picker.get_textBox();
var popupElement = picker.get_popupContainer();
var dimensions = picker.getElementDimensions(popupElement);
var position = picker.getElementPosition(textBox);
picker.showPopup(position.x - 10, position.y - dimensions.height - 5);
}
</
script
>
</
telerik:RadCodeBlock
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
></
telerik:RadScriptManager
>
<
table
>
<
tr
><
td
><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/><
br
/></
td
></
tr
>
<
tr
>
<
td
>
<
table
border
=
"0"
cellspacing
=
"0"
cellpadding
=
"3"
width
=
"100%"
>
<
tr
>
<
td
><
asp:RadioButton
ID
=
"option1"
Text
=
"option1"
GroupName
=
"group1"
runat
=
"server"
Checked
=
"true"
/></
td
>
<
td
> </
td
>
</
tr
>
<
tr
>
<
td
><
asp:RadioButton
ID
=
"option2"
Text
=
"option2"
GroupName
=
"group1"
runat
=
"server"
Checked
=
"true"
/></
td
>
<
td
>
<
telerik:RadDatePicker
ID
=
"dtStartDate"
runat
=
"server"
Enabled
=
"true"
>
<
DatePopupButton
onclick
=
"PopupOpen();"
Enabled
=
"true"
/>
</
telerik:RadDatePicker
>
</
td
>
</
tr
>
<
tr
>
<
td
><
asp:RadioButton
ID
=
"option3"
Text
=
"option3"
GroupName
=
"group1"
runat
=
"server"
/></
td
>
<
td
> </
td
>
</
tr
>
</
table
>
</
td
>
</
tr
>
</
table
>
</
form
>
</
body
>
</
html
>
It's cs-file:
using
System;
public
partial
class
_Default : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
option1.Attributes.Add(
"onclick"
,
"enableDTPicker(false);"
);
option2.Attributes.Add(
"onclick"
,
"enableDTPicker(true);"
);
option3.Attributes.Add(
"onclick"
,
"enableDTPicker(false);"
);
}
}
In the beginning the RadDatePicker control is enabled, and click on DatePopupButton opens Calendar properly. If I select option1 or option3 the RadDatePicker becomes disabled. Then I select option3, and the RadDatePicker becomes enabled again, but after clicking on DatePopupButton the Calendar just appears and then disappears in a moment.
Why is that and how can I fix it?
Thank you