repeat中设置单元格或者行颜色

 protected void rptShow_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            string AccountCode = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "OrgName "));
           // string AccountCode = ((DataRowView)e.Item.DataItem).Row["OrgName"].ToString();
            if (AccountCode.Trim() == "------技术组" || AccountCode.Trim() == "------采编组")
            {
                //HtmlTableRow col = (HtmlTableRow)e.Item.FindControl("tdcolor"); 此为行
                HtmlTableCell col = (HtmlTableCell)e.Item.FindControl("tdcolor");
                col.BgColor = "#268cdf";
            }
            else if (AccountCode.Trim() != "")
            {
                HtmlTableCell col = (HtmlTableCell)e.Item.FindControl("tdcolor");
                col.BgColor = "#1862A1";
            }

           } 
        } 

你可能感兴趣的:(设置)