Solved

.NET button font color change on mouseover

Posted on 2003-11-29
2
2,265 Views
Last Modified: 2013-12-03
Is there any way to get a .NET (2003) web form asp button control to change font color on mouseover?

If not, I need a control that can do a rollover and still cause a submit and run a code behind click method on post-back.
0
Comment
Question by:nicholas_1969
2 Comments
 
LVL 15

Expert Comment

by:Raisor
Comment Utility
Hi,

I think this here is a very good example on how to build the desired function ... its about a calender control ... but generally very comprehensive ...

"Easily Adding Functionality to ASP.NET Server Controls - By Scott Mitchell"
http://aspnet.4guysfromrolla.com/articles/100103-1.aspx

Best regards, Raisor
0
 
LVL 5

Accepted Solution

by:
CaptainRantflaps earned 250 total points
Comment Utility
Hi Raisor
Do the following :-

Create to style classes in your style sheet (or between Style tags on the html view of the page) one called btnOver - which is how you want the button to look when the mouse is over, the other called BtnOut

Now add you button to the page and set the cssclass property to BtnOut

then flip to the HTML view of the page from the page design view (bottom left of page)
find the button and add the following to line html
onmouseover="javascript:this.className='BtnOver'"  onmouseout="javascript:this.className='BtnOut'"

You whole line should now look a bit like

<asp:button id="CmdFinances" onmouseover="javascript:this.className='BtnOver'" style="Z-INDEX: 106; LEFT: 626px; POSITION: absolute; TOP: 11px" tabindex="101" onmouseout="javascript:this.className='BtnOut'" height="24px" text="Finances" cssclass="btn" width="112px" runat="server"></asp:button>

DONT WORRY ABOUT THE RED WAVY UNDERLINES - IT WILL STILL COMPLIE AND WORK.

No run your project and it should change as the mouse goes over.

Hope this helps

Simon.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
erros on link  checking 2 42
what font behind pdf 32 100
DNS, website, godaddy 6 41
Best Practice CSS floating images 2 15
Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to count occurrences of each item in an array.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now