在webframe中怎么样改变DataGrid单元格背景色? 要做一个考勤管理,需要在迟到,矿工,缺勤几种情况显示不同单元格学景色,请问怎么做啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.chinaaskpro.com/2005412/2005412171555386.html DataGrid1.Items[0].Cells[0].Attribution.Add("style","back-color:red"); private void DataGrid1_ItemDataBound(object sender,System.Web.UI.WebControls.DataGridItemEventArgs e)e.Item.Items[0].Cells[0].Attributes.Add("bgColor", "#C1D2EE"); bgColorprivate void DataGrid1_ItemDataBound(object sender,System.Web.UI.WebControls.DataGridItemEventArgs e)e.Item.Cells[0].Attributes.Add("bgColor", "#C1D2EE"); 楼上的都说明了,在itemdatabound里面写,不过你要注意cells[i]中的i是代表列序数,如果有隐藏列也要计算在内其次还要加个条件if(e.item.itemindex>=0){ e.item.celles………………} ASP.NET子页面和父页面加载问题 JS中的变量怎么表示? 关于calendar的简单问题 如何取到这个值? 一个SQL语句 上传图片 求救!如何让动态显示的Table覆盖DropDownList控件? 如何让一个静态的页面根据数据库中对各个用户不同的权限动态的显示?很急! 思归兄,请进!IIS 服务起不来。不是端口问题。 在上传文件的时候为什么PostedFile对象总是NULL? .Net中发送邮件的问题。 字符串截取问题
e.Item.Items[0].Cells[0].Attributes.Add("bgColor", "#C1D2EE");
e.Item.Cells[0].Attributes.Add("bgColor", "#C1D2EE");
其次还要加个条件
if(e.item.itemindex>=0)
{
e.item.celles………………
}