0

Here is the code of my date selecting control. When the page containing the control is submitted AFTER the Page_Load and link button click events passed, tb is reset to it is initial value (which is today)

<div class="ui-form-text">
    <div>
        <asp:TextBox ID="tb" runat="server" autocomplete="off"></asp:TextBox></div>
</div>
<ajaxToolkit:CalendarExtender ID="ce" runat="server" TargetControlID="tb" Format="dd/MM/yyyy"
    CssClass="calendar" EnableViewState="true">
</ajaxToolkit:CalendarExtender>
<ajaxToolkit:MaskedEditExtender ID="mee" runat="server" TargetControlID="tb" Enabled="true"
    Mask="99\/99\/9999" ClearMaskOnLostFocus="false" EnableViewState="true">
</ajaxToolkit:MaskedEditExtender>
<asp:CompareValidator ID="cv" runat="server" ControlToValidate="tb" Display="Dynamic"
    ErrorMessage="Невалидна дата" Operator="DataTypeCheck" Type="Date" ForeColor="Red">
</asp:CompareValidator>
<asp:RangeValidator ID="rv" runat="server" ControlToValidate="tb" Type="Date">
</asp:RangeValidator>
Брайков
  • 147
  • 2
  • 10

2 Answers2

0

I am having the same problem myself and the only solution (well, workaround) I could find was this:

ASP.NET Ajax CalendarExtender will not update SelectedDate value

Community
  • 1
  • 1
Hex
  • 3
  • 3
  • 1
    While this is helpful, linking to another SO question isn't an acceptable answer here. –  Jun 24 '12 at 16:09
0

I hope this can help you, this worked for me.


String tmp_;
protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            if (Request[txtCalendarExtender.UniqueID] != null)
            {
                if (Request[txtCalendarExtender.UniqueID].Length > 0)
                {
                    this.tmp_ = Request[txtCalendarExtender.UniqueID];
                }
            }
        }
    }
Orlando Herrera
  • 3,481
  • 1
  • 34
  • 44