Wednesday, June 6, 2007

Mouse Hover effect on datagrid.

Here is the code for mouse hover effect in ASP.NET using C#.

I have written a another code for mouse hover effect in data gird. You can do both for alternating item and item rows.

First You have to create a item created event of datagrid and paste the following...

private void datagrid_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
if (e.Item.ItemType==ListItemType.AlternatingItem)
e.Item.Attributes.Add("OnMouseOver", " = 'lightblue';");
e.Item.Attributes.Add("OnMouseOut", " = '#E5F2FA';");
else if(e.Item.ItemType==ListItemType.Item)
e.Item.Attributes.Add("OnMouseOver", " = 'lightblue';");
e.Item.Attributes.Add("OnMouseOut", " = 'white';");


Post a Comment

Your feedback is very important to me. Please provide your feedback via putting comments.

About Me
My Photo

Full Stack Developer,Blogger,Microsoft Mvp, Mentor, Life long learner, 10+ Years of Experience for JavaScript, web and Microsoft technologies. ASP.NET MVC,Web Forms,C#,AngularJs,Golang
Mvp profile
Subscribe to my blog

Enter your email address:

Follow us on facebook
Blog Archive
Total Pageviews