Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I handle a OnMouseOver event?

Status
Not open for further replies.

jw970170

Programmer
Aug 8, 2005
38
Hello,

I would like to handle an onmouseover event with something like

Private Sub Temp(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Panel1.MouseOver

'stuff
End Sub

Unfortunately, this event is not available. With javascript, however, it is. Is there someway to get a vb.net webproject to see this event?

I know that I can do

Panel1.Attributes("OnMouseOver") = "javascript://handle event"

but I want to do it in a vb.net function in my main class. Thansk in advance for your help
 
I'm not sure that's a good Idea. Doing round trip to the server for a mouse-over sounds like it would be annoying.

Still using the javascript method, see if you can post the form to the server.
 
Whle I think this is a bad idea it is fun to think of

Add name="Form1" to the form tag

Add this to the thing you want to do the post back.
onmouseover="javascript:document.Form1.submit();"

When I did this the page posted back 300 times in 5 seconds. Not what you want.
 
you know what, I think you guys are right about it. I realized that ASP is server side wheras the javascript events I'm thinking of are client side...so I best to keep them on the client side.
 
This was a helpful thread for me, I was looking for the same thing and realize I need to change my site design a bit for it so I use client side for the mouse over.

So, I have a page that had some ASP.Net buttons. I have replaced those with some images that change for mouseover and onclick events. I want to avoid making a zillion pages so what I would like to do is have the link point back to the same page. Is there a way for me to tell which button was clicks so I can use that to set values of my ASP.net label objects?

I'm thinking maybe I need to make a link like

What I don't know is how do I grab the buttonpressed part? Is it just
linkValue = Request("buttonpressed")

Thanks in advance.

Mark
 
maybe you should express what you're trying to accomplish...because you could use image buttons just as you would a regular button...(aka, changing for mouseovers, etc)

then have a click event for each image button, not reload the entire page, but just execute a block of server side code related to that button...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Thanks,

What I am trying to do is combine server side with client side code for buttons. Can that be done?

I hope you find this post helpful.

Regards,

Mark
 
Yes that can be done...give some specific examples...

imgButton.attributes.add("onmouseover","this.style....")

is how you can add client side attributes to a server control.

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
imgButton.attributes.add("onmouseover","this.style....")

Thank you, that is exactly what I was looking for. Can I bug you once more and ask to just cary that out a little more so I can see how the this.style is used when specifying a new button image?

I hope you find this post helpful.

Regards,

Mark
 
just look up some javascript functions in the Javascript forum or google it...

i usually just use this for link button highlighting...

Code:
Me.lbtnAddGoal.Attributes.Add("onmouseout", "this.style.backgroundColor=""#ebf0ff""")
Me.lbtnAddGoal.Attributes.Add("onmouseover",
"this.style.backgroundColor=""#cdd7f2""")

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Excellent, thanks.

I hope you find this post helpful.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top