Click here to Skip to main content
13,835,332 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi everybody,
I need a javacript function for showing a div on the mouse over of an image button, which is an item of a datalist, so please help me for finding the solution.
Thanking you...
Posted
Updated 10-May-17 6:18am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You need to read this:
How to: Customize DataList Items at Run Time [^]

In your datalist ItemDataBound:
protected void DataList1_ItemDataBound(object sender, 
        DataListItemEventArgs e)
{
   if(e.Item.ItemType == ListItemType.Item || 
          e.Item.ItemType == ListItemType.AlternatingItem)
   {
       // Use findControl to get the image. 
       // Use image.Attributes.Add("onmouseover", "alert('Hi!');");
    }
}
   
Comments
vpmanu 21-May-10 1:57am
   
Thank you for your reply,
I need to perform the click of the image button when we mouse over of the image button, how to perform this?
Ratish jha 18-Jan-13 2:22am
   
pls send full code for this
mohit.jain363@yahoo.com
Sandeep Mewara 18-Jan-13 5:50am
   
Anything else? Money... Gold... Burger?

:)
Ratish jha 18-Jan-13 2:23am
   
show div on mouseover in dtata'otem template-image tag
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

vpmanu wrote:
I need to perform the click of the image button when we mouse over of the image button, how to perform this?


Once you have appended the Javascript to MouseOver as described earlier, in the JS event you can call/trigger the imagebutton's click event!

Pass 'this' as one of the parameters to the JS to have direct access to it.
// code behind use:
// imageBut.Attributes.Add("onmouseover", "OnMouseOverCustom(this);");

// Javascript
// function OnMouseOverCustom(myControl)
//{
//     myControl.Click();
//}
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi

First make the div css visibility:hidden and a javascript function as below change according to u r requirement

function hideDiv(divID,visibility)
{
if(visibility == false)
{
var divelement = document.getElementByID(divID)
divelement.visibility = hidden;
}
else
{
var divelement = document.getElementByID(divID)
divelement.visibility = visible;
}
}

on mouse over just send visibility true and on mouse out visbility false
if u have to position the div use absalute and position according to u r current mouse pointer position
   
Comments
Sandeep Mewara 21-May-10 1:08am
   
I guess he needs to know how to add a javascript function to image button placed inside a datalist.
vpmanu 21-May-10 1:54am
   
Thank you for your reply, i know to write these type of function, my problem is how to get the datalist item in the javascript, for example, if i copy your function to the tag, and how to set the attributes to my datalist item

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190114.1 | Last Updated 10 May 2017
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100