Set a breakpoint at the start of the code inside the event and step through the code. You will see exactly what is happening.
If you are not familiar with the debugger, here is a video that will get you started quickly:
Basic Debugging with Visual Studio 2010 - YouTube[
^]
And here is how to fix the StackOverflow exception:
private bool isChanging;
protected void txtAsset_TextChanged(object sender, EventArgs e)
{
if (isChanging) return;
isChanging = true;
lblSuccessful.Text = string.Empty;
txtAsset.Focus();
string input = txtAsset.Text;
if (!Regex.IsMatch(input, @"^[0-9]\d*"))
{
lblSuccessful.CssClass = "ErrorMessage";
lblSuccessful.Text = "You have input invalid criteria";
txtAsset.Text = string.Empty;
txtAsset.Focus();
}
else
{
Execute Retrieval of record
}
isChanging = false;
}