By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,028 Members | 1,945 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,028 IT Pros & Developers. It's quick & easy.

Change button backcolor in C# ASP.NET

P: n/a
how to change the button backcolor with C# in coding. I want to change back color of the button when I click it.
Million Thanks..
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
is it Server control or HTML control?
for server control :

Button2.BackColor = Color.Red;

for html control : you can do it on the script.. button.style.backgroundColor = "red";

Av.
"Grey" <er*****@i-cable.com> wrote in message news:uS*************@TK2MSFTNGP11.phx.gbl...
how to change the button backcolor with C# in coding. I want to change back color of the button when I click it.
Million Thanks..
Nov 18 '05 #2

P: n/a
You could do this in client side script wit

[c#
btn.attributes["onclick"] = "this.style.backgroundColor='red';"

or if you were posting back to the server anyway, in the event handler for the button clic

[c#
btn.BackColor = Color.red

Ada
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.