<mm:mmTextBox ID="txtExpiryDate" runat="server" BindingSource="Policy" BindingSourceMember="ExpiryDate" DisplayFormat="{0:d}" Width="79px" CssClass="date" AutoPostBack="true" OnTextChanged="txtExpiryDate_TextChanged"></mm:mmTextBox> <mm:mmTextBox ID="txtRetirementAge" runat="server" BindingSource="Policy" BindingSourceMember="RetirementAge" Width="54px" AutoPostBack="true" OnTextChanged="txtRetirementAge_TextChanged"></mm:mmTextBox>My code is this:
protected void txtExpiryDate_TextChanged(object sender, EventArgs e) { // update Age at retirement if (this.oPlan.Entity.PlanTypeFK == 1) // Annuity { // work out age at retirement this.txtRetirementAge.Text = this.oClient.GetAgeNearest(this.oClient.Entity.DateOfBirth, Convert.ToDateTime(this.txtExpiryDate.Text)).ToString(); } } protected void txtRetirementAge_TextChanged(object sender, EventArgs e) { // update Date of expiry/maturity if (this.oPlan.Entity.PlanTypeFK == 1) // Annuity { // work out the age difference between age at issue and retirement age Int16 ageDiff = (Int16)(Convert.ToInt16(this.txtRetirementAge.Text) - oPolicy.Entity.AgeAtIssue); // add the difference to the issue date DateTime dt = (DateTime)this.oPolicy.Entity.IssueDate; dt = dt.AddYears(ageDiff); this.txtExpiryDate.Text = dt.ToString(); } }This works fine if I change the date, the age gets recalculated properly. But if I change the age, and I set a breakpoint in xtRetirementAge_TextChanged, it is showing me that the this.txtRetirementAge.Text is the old value, not the value I just entered!