Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to change back color of the button when i click it in asp.net with c#

Thank You!
Posted

On server side (by doing the postback, you can go like this:

C#
protected void Button1_Click(object sender, EventArgs e)
{
    Button1.BackColor = Color.Yellow;
}


Cheers
 
Share this answer
 
Comments
[no name] 18-Sep-12 5:48am    
yours also working
C#
protected void Button1_Click(object sender, EventArgs e)
{
    Button1.BackColor = Color.Red;
}
 
Share this answer
 
Use simple jquery to change the background
JavaScript
$('#button').click(function(){
    $(this).css("background-color","yellow");
});
 
Share this answer
 
Comments
[no name] 18-Sep-12 5:48am    
yours also working
Abhijit Parab 18-Sep-12 6:01am    
It is better to do in scripting like disabling controls, changing color of control.
Good solution Anuja.........
Anuja Pawar Indore 20-Sep-12 1:05am    
Thanks Abhijit

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900