Heres the solution :
Declare "System.Web.UI.WebControls.TextBox tot;" and "TableCell tc3 = new TableCell();" out of the for-loop.
for (int c = 0; c < 3; c++)
{
inc += 1;
tc3.BorderStyle = System.Web.UI.WebControls.BorderStyle.Ridge;
tot = new System.Web.UI.WebControls.TextBox();
tot.ID = "tot" + inc.ToString();
tot.Width = 40;
tc3.Controls.Add(tot);
tr1.Cells.Add(tc3);
}
To fill the TextBoxes enumerate the Controls.
Like this :
int iIndex = 0;
List<String> lItems = new List<String>();
lItems.Add("Ram");
foreach (System.Web.UI.WebControls.WebControl wcObject in tc3.Controls)
{
if (wcObject.ID.Contains("tot"))
{
((System.Web.UI.WebControls.TextBox)wcObject).Text = lItems[iIndex];
iIndex++;
}
}