The .Text on add is giving the error, I believe I have the right assemblies in place.
StringCollection sc = new StringCollection();
for (int i = 1; i <= 2; i++)
{
//extract the TextBox values
string txt1 = ((TextBox)Page.FindControl("TextBox1" + i.ToString())).Text;
string txt2 = ((TextBox)Page.FindControl("TextBox2" + i.ToString())).Text;
string txt3 = ((TextBox)Page.FindControl("TextBox3" + i.ToString())).Text;
string txt4 = ((TextBox)Page.FindControl("TextBox4" + i.ToString())).Text;
string txt5 = ((TextBox)Page.FindControl("TextBox5" + i.ToString())).Text;
string txt6 = ((TextBox)Page.FindControl("TextBox6" + i.ToString())).Text;
string txt7 = ((TextBox)Page.FindControl("TextBox7" + i.ToString())).Text;
string txt8 = ((TextBox)Page.FindControl("TextBox8" + i.ToString())).Text;
string txt9 = ((TextBox)Page.FindControl("TextBox9" + i.ToString())).Text;
sc.Add(txt1.Text, txt2.Text, txt3.Text, txt4.Text, txt5.Text, txt6.Text, txt7.Text, txt8.Text, txt9.Text);
}
InsertRecords(sc);
You are basically calling
string.Textsince the type oftxt1, txt2, etcis string, hence the error. But note that you are already calling.Texton theTextFieldcontrol so what you probably intend to do is: