Shahid Riaz Bhatti

if(my.work == “Interesting” || my.availableTime > my.workHours) { this.blog.Post();}

Hightlight GridView row on mouse over event

June 02
by Shahid Riaz Bhatti 2. June 2009 08:03

Code is self explanatory. No explanation is needed. Try to run this code and see the result yourself. :) 

protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)

{

// only apply changes if its DataRow

if (e.Row.RowType == DataControlRowType.DataRow)

{

// when mouse is over the row, save original color to new attribute, and change it to highlight yellow color

e.Row.Attributes.Add("onmouseover", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='SkyBlue'");

// when mouse leaves the row, change the bg color to its original value

e.Row.Attributes.Add("onmouseout","this.style.backgroundColor=this.originalstyle;");

//Color.

}

}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

ASP.Net

RecentComments

Comment RSS

Most comments

supplynflshop supplynflshop
51 comments
tiffany-bracelets tiffany-bracelets
39 comments
AVI to iPad AVI to iPad
36 comments