Hi ,
Check this
Be aware of the loop will change according to container which contain the controls
List<string> txt = new List<string>();
protected void Button1_Click(object sender, EventArgs e)
{
foreach (Control ctrl in form1.Controls)
{
if (ctrl is TextBox)
{
txt.Add(((TextBox)ctrl).Text);
Session.Add("lst",txt);
}
}
}
protected void Button2_Click(object sender, EventArgs e)
{
txt=(List<string>) Session["lst"];
GridView1.DataSource = txt.ToList();
GridView1.DataBind();
}
Best Regards
M.Mitwalli