[英]How to get buttons to return back to its original state after a series of clicks
I am making a web application where the user will click on a number of different buttons, the border of these buttons will then change color, however whenever the user clicks on the enter button I want the buttons that were previously clicked to change back to their original state. 我正在创建一个Web应用程序,用户将点击许多不同的按钮,然后这些按钮的边框将改变颜色,但是每当用户点击输入按钮时,我希望之前单击的按钮更改回他们的原始状态。
Any help is appreciated 任何帮助表示赞赏
protected void btnTeam1_Click(object sender, EventArgs e) {
btnTeam1.BorderColor = System.Drawing.Color.Yellow;
lblMessage2.Text = "Home Team";
}
protected void btnTeam2_Click(object sender, EventArgs e) {
lblMessage2.Text = "Away Team";
btnTeam2.BorderColor = System.Drawing.Color.Yellow;
}
The user then goes and clicks an enter button which inputs data into a DB. 然后用户转到并单击输入按钮,该按钮将数据输入到DB中。 Whenever the enter button is clicked I would like the buttons that have been clicked to have no yellow border 每当点击输入按钮时,我希望点击的按钮没有黄色边框
Add these lines to the Click function for your enter button: 将这些行添加到enter按钮的Click函数中:
btnTeam1.BorderColor = System.Drawing.Color.Empty;
btnTeam2.BorderColor = System.Drawing.Color.Empty;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.