• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

Is it possible to create on mouseover effect on...

Is it possible to create mouse hover effect on ASP.NET custom server control?
4 Solutions
käµfm³d 👽Commented:
Well a custom server control is just a control that you determine how it should be rendered in HTML. You should be able to add "onmouseover" to each part of the HTML that represents your control.
yes... use the HTML view when you put your control in, and type it in there... example:

<asp:UserControl ....... ... .... ... OnMouseOver="JavaScript:CreateEffect("<%=Me.ControlID.ClientID%>");" onMouseOut="JavaScript:EndEffect("<%=Me.ControlID.ClientID%>");" />

something like that...

now if you're talking about the VB (fat client) MouseHover Event, then no... ASP.Net is server side, and therefore if you want to create client-side hover effect, you'll have to use client-side scripting (like JavaScript).
PagodNaUtakAuthor Commented:
Please correct me if I am wrong...

I cannot create an event that will be triggered when mousehover my controls?

As in...

Public MyCustomEvent as Event?
nope... as far as i know, the event will have to be client side... what you CAN do however, is have somewhat of a workaround, in that you can call a server-side function on the hover, BUT, it'll submit the page...
onmouseover will call your client side function, and not on server side.
To call server side, You can use AJAX.
or just calling the client function, which calls the button click event

Refer this code
            function callButtonEvent(btn)

//in codebehind

customControl.Attributes.Add("onblur", "javascript:callButtonEvent('" + btnHidden.ClientID + "');");

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now