I am using OnTextChanged event of a TextBox run code behind if it lost focus , When the page is firstly load, it can trigger the behind code. However, after the first time running the behind code, if I go back to the textbox and make it lost focus again, it does not do any code behind again. How can I make the textbox trigger code behind each time it lost focus.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<telerik:RadTextBox ID="uiToLocation" runat="server" Width="100%" AutoPostBack="true"
OnTextChanged="uiToLocation_Leave" EmptyMessage="<%$ Resources:ResourceHKEx,Arrive_To %>" />
</ContentTemplate>
</asp:UpdatePanel>
The back code, main aspx.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace WebHKEx
{
public partial class FlightEdit : Web.CustomPage
{
protected void Page_Init(object sender, EventArgs e)
{
// initialize variables
InitializeVariables();
// permission checking
VerifyUserPermissions(true);
// initialize controls
InitializeControls();
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Page_UnLoad(object sender, EventArgs e)
{
}
} // end class
} // end namespace
And the code behind is in a subcontrol cs file.
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace WebHKEx.WebControls
{
public partial class UsageControl2SubControl1 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToBoolean(uiRemoved.Value))
{
this.Visible = false;
}
}
protected void uiToLocation_Leave(object sender, EventArgs e)
{
uiDistance = "123";
}
}// end class
}// end namespace