This is a migrated thread and some comments may be shown as answers.

hover effect for the button

1 Answer 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryann
Top achievements
Rank 1
Ryann asked on 20 Dec 2013, 01:44 PM
Hi
i have a buttoncolumn with buttontype as image . I want to create a hover effect for the button only. How to get it?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Dec 2013, 01:51 PM
Hi Ryann,

Please try the following code snippet to have hover effect over a button:

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{     
    if (e.Item is GridDataItem)
    {
        GridDataItem item = (GridDataItem)e.Item;
        ImageButton btn = (ImageButton)item["ButtonColumnUniqueName"].Controls[0];
        btn.Attributes.Add("onMouseOver", "this.style.backgroundColor = 'red';");
        btn.Attributes.Add("onMouseOut", "this.style.backgroundColor = '';");
    }    
}

Thanks,
Shinu
Tags
Grid
Asked by
Ryann
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or