Hi,
You are switching
TextBox
, but in the case statement you are using string to identify the TextBoxes. Try this:
protected void tb1_TextChanged(object sender, EventArgs e)
{
string value1 = string.Empty;
string value2 = string.Empty;
string value3 = string.Empty;
string value4 = string.Empty;
string value5 = string.Empty;
TextBox txtFirst = (TextBox)sender;
TextBox tbval0 = (TextBox)Page.Form.FindControl(("txt0"));
TextBox tbval2 = (TextBox)Page.Form.FindControl(("txt2"));
TextBox tbval3 = (TextBox)Page.Form.FindControl(("txt4"));
TextBox tbval5 = (TextBox)Page.Form.FindControl(("txt5"));
TextBox tbval4 = (TextBox)Page.Form.FindControl(("txt1"));
TextBox tbval6 = (TextBox)Page.Form.FindControl(("txt3"));
TextBox tbval7 = (TextBox)Page.Form.FindControl(("txt6"));
switch (txtFirst.ID.ToString()){
case "txt0":
value1 = tbval0.Text.ToString();
break;
case "txt2":
value2 = tbval2.Text.ToString();
break;
case "txt4":
value3 = tbval3.Text.ToString();
break;
default:
break;
}
}
--Amit