I'm using the following java script to make the calendar appear with the right edge aligned with the bottom right corner of the "TextBox"
When the page first loads and I click the DateButtonPopup the calendar width = 238px which positions it incorrectly, if I click the button to display the calendar again the width is now = 220px and it is positioned correctly.
Does anyone have any ideas?
<
telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function PositionCalendar(sender, pickerID) {
var datePicker;
if (pickerID != null)
{
datePicker = $find(pickerID);
if (datePicker.isPopupVisible()) {
datePicker.hidePopup();
}
else {
var textBox = datePicker.get_textBox();
var popupElement = datePicker.get_popupContainer();
var calendarDimensions = datePicker.getElementDimensions(popupElement);
var textboxPosition = datePicker.getElementPosition(textBox);
var textboxDimensions = datePicker.getElementDimensions(textBox);
datePicker.showPopup((textboxPosition.x + textboxDimensions.width) - calendarDimensions.width, (textboxPosition.y + textboxDimensions.height));
}
}
}
</script>
</
telerik:RadCodeBlock>
CodeBehind:
protected override void OnPreRender(EventArgs e)
{
base
.OnPreRender(e);
this
.rdpFrom.DatePopupButton.Attributes.Add("onclick", "PositionCalendar(event, '" + this.rdpFrom.ClientID + "');return false;");
}