为什么我的按钮(按钮数组)在我单击其中任何一个后消失?这是代码结构。提前非常感谢。
public partial class Seatalloc2 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PopulateControls();
}
}
protected void PopulateControls()
{
Button[,] buttonArray = new Button[10, 14];
for (int a = 0; a < 10; a++)
for (int b = 0; b < 14; b++)
{
buttonArray[a, b] = new Button();
Panel2.Controls.Add(buttonArray[a, b]);
}
}
public void buttonHandler(object sender, EventArgs e)
{
Button btn = sender as Button;
btn.BackColor = Color.Red;
}
}