[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 314
  • 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


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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