473,508 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change button backcolor in C# ASP.NET

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
2 25204
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
20751
by: codemonkey | last post by:
TIA! I would like to know if there is a way to dynamically change the colors of Subform items? I have already set in place Conditional Formatting so each row has an alernating color scheme, but...
3
18871
by: OutdoorGuy | last post by:
Greetings, I have a very "novice" question to ask, so hopefully it will be easy. At any rate, I have a label on a Windows form called "label1". I simply want to change the "backcolor" property...
18
2929
by: Colin McGuire | last post by:
Hi - this was posted last weekend and unfortunately not resolved. The solutions that were posted almost worked but after another 5 days of working on the code everynight, I am not further ahead....
7
1954
by: Try Guy | last post by:
I would like the background of a button so pulsate between to given colors with the speed of a given timeinterval... I have two questions: What can I use to control the interval thing with? I...
2
13403
by: HS1 | last post by:
Hello all Do you know how to change color of a button when the mouse is over it (like a button in manu bar can change its color in a website) in VB.net Thank you S.Hoa
12
1805
by: Rudy | last post by:
Hello all, Can you take a button, color it green, have the user click on it, change the color to red, to show it has been selected. IF so, how? As always, thank in advance! Rudy
4
7580
by: Thomas Homan | last post by:
All, Is there an easy way to interate through a group of radio buttons (9 of 'em) contained within a group box in VS2005. I really don't want to have to evaluate each one... TIA! Tom
9
3761
by: martin1 | last post by:
Hi, All, how to flash button with 2 color( eg. red and white)? then when user click button, the button stop flash and stay red color? Thanks
3
3274
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
0
7129
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7333
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.