开发者

How do i reset values of dynamically created controls on ASP .NET c# page?

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() ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜