Friday, September 5, 2008

To change The color of the Grid View Row on Mouse Move...

Hi...
I am going to describe you ,How to change the color/style of the Gridview row on mouse move .For this You need only add RowCreated event in the HTML of the Gridview plus just paste the following code to your CodeBehind of your page.


protected void YourGridView_RowCreated(object sender, GridViewRowEventArgs e) {
if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#00BFFF'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.originalstyle;");
}

}


Enjoy Coding...
Thanks And Regards:
Sanjeev Chauhan

No comments: