我创建了一些按钮,当用户单击按钮时它会改变背景颜色,但是当用户按下另一个按钮时我需要将背景颜色更改为默认颜色
max = Service.Max_id();
max = max - 1;
for (int i = 0; i < max; i++)
{
int x = i + 1;
string num = (i + 1).ToString();
DataTable dt = Service.fillWid((i + 1).ToString());
string titlee = "";
titlee = dt.Rows[0]["name"].ToString();
ckplaceat = new Button();
ckplaceat.ID = titlee;
ckplaceat.Text = titlee;
ckplaceat.Click += new EventHandler(ButtonClickOneEvent);
ckplaceat.Style["Width"] = "115px";
// ckplaceat.BackColor = Color.LightGray;
ckplaceat.CssClass = "wButton";
PlaceHolder1.Controls.Add(ckplaceat);
PlaceHolder1.Controls.Add(new LiteralControl(" "));
//PlaceHolder1.Controls.Add(new LiteralControl("<br/>"));
}
protected void ButtonClickOneEvent(object sender, EventArgs e)
{
ckplaceat.BackColor = default(Color);
btn = (Button)sender;
btnclicked = (sender as Button).ID;
for (int i = 0; i < max; i++)
{
idFunction();
// changecolor();
widgetChangeFun();
btn.BackColor = Color.Black;
}