protected void GridView1_RowDataBound (object sender, GridViewRowEventArgs e)
{
//To mark rows that meet specific criteria as highlighted
if (E.row.rowtype = = Datacontrolrowtype.datarow)//Determines whether the current row belongs to the DataRow type of the row
{
int money = Convert.toint3 2 (DataBinder.Eval (E.row.dataitem, "money");//Fetch the column value of the current row
if (money = =)
E.row.backcolor = color.red;< br>//string customer = (string) DataBinder.Eval (E.row.dataitem, "customer");
String customer = DataBinder.Eval (E.row.dataitem, "customer"). ToString ();
if (customer = = "SDF")
E.row.backcolor = color.red;
//Add the mouse-over highlighting
if (E.row.rowtype = = Datacontrolrowtype.datarow)//Determines whether the current row is of the DataRow type
{
When the mouse is put up, first save the background color of the current row and attach a color to the
E.row.attributes.add ("onmouseover", "currentcolor=this.style.backgroundcolor;th Is.style.backgroundcolor= ' Yellow ', this.style.fontweight= '; ');
//The previous color of the background color restored when the mouse is left
E.row.attributes.add ("onmouseout", "this.style.backgroundcolor=currentcolor,this.style.fontweight= ';");
}
//Click to change the row background color
if (E.row.rowtype = Datacontrolrowtype.datarow)
{
E.row.attribu Tes. ADD ("onclick", "this.style.backgroundcolor= ' #99cc00 '; this.style.color= ' buttontext '; this.style.cursor= ' default ';");
}