I define an array in in the class, not in any method, as a global variable, in the same scope of method:
TextBox[,] tx = new TextBox[100,100];
TableCell[,] tc = new TableCell[100, 100];
TableRow[] tr = new TableRow[100];
And I initialize them in Page_Init event:
protected void Page_Init(object sender, EventArgs e)
{
if (!IsPostBack)
{
//only for initiializing
for (int i = 0; i < 100; i++)
{
tr[i] = new TableRow();
for (int j = 0; j < 100; j++)
{
tx[i, j] = new TextBox();
tc[i, j] = new TableCell();
}
}
}
}
ut when I click a button or any post back event, the variables turn null again! What's wrong in that?
=========================================================================
That was solved by using Session to store them in, but now something missing. How to save the values in the text boxes into this Session container? And when to do that?