i have an array of buttons added to a panel control and need to reset them to their original values, is this possible pragmatically?
protected void Page_Load(object sender, EventArgs e)
{
RenderTable();
}
private void RenderTable()
{
Button[] b开发者_JAVA技巧oard = new Button[9];
for(int i =0; i <board.Length; i++)
{
board[i] = new Button();
board[i].Text = " ";
board[i].Width= board[i].Height = 50;
board[i].Click += PlayerClick;
board[i].ID = "pos" + i;
Panel1.Controls.Add(board[i]);
}
}
You will need to store the values yourself in session, viewstate, or simply look in the post values for them. You're already using a custom ID so use those values if you use the form post method.
You should be able to store an array of the original values as well, and loop through reassigning them.
panel.Controls.Clear() ?
精彩评论