Skip to content

Instantly share code, notes, and snippets.

@wuliupo
Last active August 29, 2015 13:56
Show Gist options
  • Save wuliupo/9087735 to your computer and use it in GitHub Desktop.
Save wuliupo/9087735 to your computer and use it in GitHub Desktop.
fix the position of asp:CalendarExtender
<asp:TextBox ID="idInputButton" runat="server" />
<asp:ImageButton ID="idImageButton" ImageUrl="~/Images/calender.png" AlternateText="Click to show calendar" runat="server" />
<asp:MaskedEditExtender ID="fromCalendarMEE" runat="server"
TargetControlID="idInputButton" Mask="9999/99/99" MaskType="Date" Century="2000" AutoComplete="true" CultureName="sv-SE"/>
<asp:CalendarExtender OnClientShown="fixCalendarPosition" ID="fromCalendarButtonExtender" runat="server" TargetControlID="idInputButton" PopupButtonID="idImageButton" Format="yyyy'-'MM'-'dd" />
<script type="text/javascript">
function fixCalendarPosition(cal) {
var off = $(cal._element).offset();
$(cal._container).css({position: 'fixed', left: off.left, top: off.top + 22});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment