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

Posted on 2011-05-12
Last Modified: 2012-05-11
Is it possible to create mouse hover effect on ASP.NET custom server control?
Question by:PagodNaUtak
    LVL 74

    Accepted Solution

    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.
    LVL 10

    Assisted Solution

    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).
    LVL 8

    Author Comment

    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?
    LVL 10

    Assisted Solution

    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...
    LVL 1

    Assisted Solution

    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    737 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

    15 Experts available now in Live!

    Get 1:1 Help Now