Wednesday, May 9, 2012

สลับสี Row บน Datagrid

protected void dtgShowupload_RowCreated(object sender, GridViewRowEventArgs e)
{
      if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add(
"onmouseover""this.style.backgroundColor='#CCCCCC';");
            
if (e.Row.RowIndex % 2 == 0)
                 {
                      e.Row.Attributes.Add(
"onmouseout""style.backgroundColor='#EFF3FB'"); // หาสีที่ใกล้เคียงเองเนอะ....
                  
}
            
else
                 
{
                      e.Row.Attributes.Add(
"onmouseout""style.backgroundColor='White'");
                 }
        }

}

No comments:

Post a Comment