Linc Posted March 5, 2009 Share Posted March 5, 2009 if someone could post how to trigger the mouse over, and what code to use, that would be amazing.... thanks. Link to comment Share on other sites More sharing options...
0 Bookieass Posted March 6, 2009 Share Posted March 6, 2009 a liitle more descriptive on what u want to do and what happens next would be really appreciative???? Link to comment Share on other sites More sharing options...
0 Linc Posted March 6, 2009 Author Share Posted March 6, 2009 a liitle more descriptive on what u want to do and what happens next would be really appreciative???? Sorry i am making a website in visual studio 2005 in C# i am trying to see if i can make mouse over for the buttons how to trigger the mouse over code on the graphic in the design mode "if possible" and/or what the code would be to create the mouseover on the image that would also redirect to another page on the click event. very new to any programming any help would be appreciated, thanks again Link to comment Share on other sites More sharing options...
0 Mr. Bean Posted March 6, 2009 Share Posted March 6, 2009 What you're looking to accomplish requires javascript. Create your HTML button, and set the onmouseover attribute/event to some javascript function that handles whatever it is you want to do. Example: <script type="text/javascript"> function buttonMouseOver() { alert("the mouse went over the button!"); } </script> <input type="button" onmouseover="buttonMouseOver()" value="Im a button" /> Link to comment Share on other sites More sharing options...
0 gregb0b Posted March 6, 2009 Share Posted March 6, 2009 I believe what he is asking for is some type of button mouse over and not a pop up box alert. The question is whether it's doable in C# or not... and I have no idea. Link to comment Share on other sites More sharing options...
0 AstareGod Posted March 6, 2009 Share Posted March 6, 2009 So... you're doing this with C# and ASP.NET? As far as I know, no postback is triggered upon a mouseover... only when a user clicks it does it trigger a page postback event. However, you could definitely run any javascript by doing what Mr. Bean suggested. Just figure out how to do what you want with/in javascript. As a workaround, you *could* have it redirect to another page (aspx) or a generic handler (ashx) and have that page handle the code for what would have happened had the user move the cursor over the button, then redirect to whatever other page you wanted? Link to comment Share on other sites More sharing options...
0 Bookieass Posted March 6, 2009 Share Posted March 6, 2009 Sorry i am making a website in visual studio 2005 in C# i am trying to see if i can make mouse over for the buttons how to trigger the mouse over code on the graphic in the design mode "if possible" and/or what the code would be to create the mouseover on the image that would also redirect to another page on the click event. very new to any programming any help would be appreciated, thanks again Ok....this is what I understand of your problem MS. :) right away!!! you want to get some kind of picture/text to pop up when mousing over a button? Popup Class (System.Windows.Controls.Primitives)OR ToolTip.OwnerDraw Property (System.Windows.Forms) or change the Image of my button while I move the mouse over it.. How about this .. Image pic = (Image)cswf3.Properties.Resources.floppy.Clone(); ... private void button1_MouseHover(object sender, EventArgs e) { Button btn = (Button)sender; btn.Image = (Image) pic.Clone(); } private void button1_MouseLeave(object sender, EventArgs e) { Button btn = (Button)sender; btn.Image = null; } ... In btwn........ I crossed three figures in posting (ahh!! in 5yrs, thats poor :cry: ) :bounce: Link to comment Share on other sites More sharing options...
0 KayMan2K Posted March 6, 2009 Share Posted March 6, 2009 The C# programming language combined with the ASP.Net environment generates HTML code to send to the browser. From then on, any interaction with the user (such as effects on a mouse-over) must be handled by browser-side functionality. This may include JavaScript or the use of CSS (Cascading Styles Sheets). If you just want to change the button color, text style or whatever on a mouse-over event, then use CSS. You may set the CSS class with the property 'CssClass' and then define the CSS style in style sheet. ASP.Net may have created a default style sheet in the App_Themes/Default folder. You can put your styles in that location. For example, below is a style called 'ButtonStyle' which turns blue on the mouse-over, or hover, event. In this example, you could set the button's 'CssClass' property to 'ButtonStyle'. .ButtonStyle { } .ButtonStyle:hover { background-color:blue } Learn more about CSS.. http://htmldog.com/guides/cssbeginner/ Link to comment Share on other sites More sharing options...
0 Linc Posted March 7, 2009 Author Share Posted March 7, 2009 thanks to everyone for responding i am actually doing this for a class and it is a very simple website connected to SQL(nothing to do with my buttons) but i was just trying to use images as buttons and wondering if i could get a mouseover event to have a different image popover as well as a redirect click event. from what i gather this is going to have to be done with a different language this has to be a C# project done with ASP.net so i guess i will have to just go with boring images with no drop shadow rollover lol got spoiled with html thanks again Link to comment Share on other sites More sharing options...
Question
Linc
if someone could post how to trigger the mouse over, and what code to use, that would be amazing.... thanks.
Link to comment
Share on other sites
8 answers to this question
Recommended Posts