Click here to Skip to main content
14,733,013 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to change datagrid row color in asp.net selected index changed???
Posted

1 solution

use itembound event on datagrid
protected void dgid_ItemDataBound(object sender, DataGridItemEventArgs e)
       {
           if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
           {
               string name = e.Item.Cells[0].Text;
               if (name != null)
               {
                   e.Item.Cells[0].BackColor = Color.Red;
               }
           }
       }
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900