Step 1 : Drag and Drop GridView from Visual Studio toolbox to your asp.net web page
Step 2: In your HTML view of webpage inside the head tag or if you have .css file in your project you can write these lines of css code
Step 3: On RowCreated event of Gridview which will fire
when you can Bind() Method of Gridview for eg GridView1.DataBind();
write this code
Step 2: In your HTML view of webpage inside the head tag or if you have .css file in your project you can write these lines of css code
| < font color = "#0000ff" size = "2" >< font color = "#0000ff" size = "2" >< style type = "text/css" > |
.normalRow |
| { |
| background-color:white;/* You can update the background Color to normal Gridview Back Color */ |
| cursor:pointer;/* You can change cursor pointer to default, Pointer etc */ |
| } |
|
.highlightRow |
| { |
| background-color:Gray;/*
You can change the background Color of the row to whatever color you
want. You can also give Hexadecimal color code also */ |
| cursor:pointer;/* You can change cursor pointer to default, Pointer etc */ |
| } |
|
| </ style > |
| </ font ></ font > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
protected
void
GridView1_RowCreated(
object
sender, GridViewRowEventArgs e)
| { |
| // Leave header and footer of Gridview and assign in the rest of the item row |
| if (e.Row.RowType != DataControlRowType.Header || e.Row.RowType != DataControlRowType.Header) |
| { |
| e.Row.Attributes.Add( "onmouseout" , "this.className='normalRow'" ); |
| e.Row.Attributes.Add( "onmouseover" , "this.className='highlightRow'" ); |
| } |
| } |
No comments:
Post a Comment