Author: adt | Posted on: 3/30/2010 11:02:54 AM | Views : 426

hi, can someone tell me how to change the imageurl of an image field when I mouseover an imagebutton in a gridview?  both the imagebutton and image urls are the same location.

I'm doing this in code behind but I can't seem to get the Image1.Imageurl to change to the same ImageUrl the imagebutton is pointing to.

C#
protected void ImageButton1_PreRender(object sender, EventArgs e)
    {
         ImageButton  imageButton1 = (ImageButton)sender;
        if (imageButton1 != null && string.IsNullOrEmpty(imageButton1.Attributes["onmouseover"]))
        {
            imageButton1.Attributes.Add("onmouseover", "Image1.ImageUrl=imageButton1.ImageUrl");
    & ...

Go to the complete details ...