hiiii guys i had written a code for generating 'n' text boxes dynamically....n willbe entered in textbox1 and generates well but my problem is after generating textboxes i vl enter some integer values into them and when i click on second button all the values should be add and display in textbox1.... its not working so plz guide me

protected void Button1_Click(object sender, EventArgs e)
{
string t1 = textbox1.Text.ToString();
int t2 = Convert.ToInt32(t1);
int k = 1;
for (int i = 0; i < t2; i++)
{
TextBox t = new TextBox();
t.ID = "t" + k;
t.Text = "Branch" + k;
k++;
PlaceHolder1.Controls.Add(t);
}
protected void Button2_Click1(object sender, EventArgs e)
{
while (PlaceHolder1.HasControls())
{
TextBox t=new TextBox();
string tex = ((TextBox)PlaceHolder1.FindControl("t")).Text.ToString();
while(tex != null)
{
int kt = 0;
kt = kt + Convert.ToInt32(tex);
txtres.Text = Convert.ToString(kt);
}
}

}