I have CalendarExtender and bound it to a textbox but when i write code in textchanged event found that it doesn’t fire;here my code snippet:
<asp:TextBox ID="txtFromDate" MaxLength="10" Width="150" CssClass="textbox"
runat="server" />
code behind :
protected void txtFromDate_TextChanged(object sender, EventArgs e)
{
if (Convert.ToDateTime(txtFromDate.Text) < DateTime.Today)
{
_lblErroFromDate.Visible = true;
_lblErroFromDate.Text = "Please enter valid date !";
}
else
_lblErroFromDate.Visible = false;
}
The
TextChangedevent wont be fired until the page posts back to the server.TextBoxcontrols don’t post back the page to the server by default when their events occure. You can change this behavior by setting theAutoPostBackproperty value to true.