Reputation: 457
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;
}
Upvotes: 1
Views: 4250
Reputation: 14781
The TextChanged
event wont be fired until the page posts back to the server.
TextBox
controls don't post back the page to the server by default when their events occure. You can change this behavior by setting the AutoPostBack
property value to true.
Upvotes: 4
Reputation: 11788
I think setting AutoPostBack
property to true
will solve the problem.
Upvotes: 2