ASPxGridView改变列颜色

protected void ASPxGridView1_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)
{
string tJhso = e.GetValue("PLAN_SO").ToString();
string tJhdm = e.GetValue("PLAN_CODE").ToString();
string sql = " SELECT PLAN_CODE,PLAN_SO,CREATE_DATE,REMARK frOM DATA_PLANLOG where PLAN_SO=‘" + tJhso + "‘ and PLAN_CODE=‘" + tJhdm
+ "‘ AND ROUNTING_SITE IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = ‘ "
+ theUserId + "‘ AND PROGRAM_CODE = ‘" + theProgramCode + "‘ AND COMPANY_CODE = ‘" + theCompanyCode + "‘) "
+ " ORDER BY CREATE_DATE,PLAN_CODE ";
dc.setTheSql(sql);
DataTable dt = dc.GetTable();
if (dt.Rows.Count > 0)
{
//一些不需设置颜色的列
if (e.DataColumn.Caption.ToString() == "计划确认标识") return;
if (e.DataColumn.Caption.ToString() == "BOM转换") return;
if (e.DataColumn.Caption.ToString() == "库房确认标识") return;
if (e.DataColumn.Caption.ToString() == "是否分配流水号") return;
if (e.DataColumn.Caption.ToString() == "三方要料") return;
if (e.DataColumn.Caption.ToString() == "库房要料") return;
if (e.DataColumn.Caption.ToString() == "三方物料接收状态") return;
if (e.DataColumn.Caption.ToString() == "库房发料接收状态") return;
if (e.DataColumn.Caption.ToString() == "生产确认标识") return;
if (e.DataColumn.Caption.ToString() == "柳汽标识") return;
if (e.DataColumn.Caption.ToString() == "改制返修是否转BOM") return;
//也可以根据FieldName进行判断
//if (e.DataColumn.FieldName.ToString() == "ORDER_CODE") return;

//给需要设置颜色的列设置颜色
e.Cell.BackColor = System.Drawing.Color.Cyan;
}

string status = e.GetValue("RUN_FLAG").ToString();
if (status == "N")
{
//一些不需设置颜色的列
if (e.DataColumn.Caption.ToString() == "计划确认标识") return;
if (e.DataColumn.Caption.ToString() == "BOM转换") return;
if (e.DataColumn.Caption.ToString() == "库房确认标识") return;
if (e.DataColumn.Caption.ToString() == "是否分配流水号") return;
if (e.DataColumn.Caption.ToString() == "三方要料") return;
if (e.DataColumn.Caption.ToString() == "库房要料") return;
if (e.DataColumn.Caption.ToString() == "三方物料接收状态") return;
if (e.DataColumn.Caption.ToString() == "库房发料接收状态") return;
if (e.DataColumn.Caption.ToString() == "生产确认标识") return;
if (e.DataColumn.Caption.ToString() == "柳汽标识") return;
if (e.DataColumn.Caption.ToString() == "改制返修是否转BOM") return;

//给需要设置颜色的列设置颜色
e.Cell.BackColor = System.Drawing.Color.Red;
}

status = e.GetValue("CONFIRM_FLAG").ToString();
if (status == "N")
{
//一些不需设置颜色的列
if (e.DataColumn.Caption.ToString() == "计划确认标识") return;
if (e.DataColumn.Caption.ToString() == "BOM转换") return;
if (e.DataColumn.Caption.ToString() == "库房确认标识") return;
if (e.DataColumn.Caption.ToString() == "是否分配流水号") return;
if (e.DataColumn.Caption.ToString() == "三方要料") return;
if (e.DataColumn.Caption.ToString() == "库房要料") return;
if (e.DataColumn.Caption.ToString() == "三方物料接收状态") return;
if (e.DataColumn.Caption.ToString() == "库房发料接收状态") return;
if (e.DataColumn.Caption.ToString() == "生产确认标识") return;
if (e.DataColumn.Caption.ToString() == "柳汽标识") return;
if (e.DataColumn.Caption.ToString() == "改制返修是否转BOM") return;

//给需要设置颜色的列设置颜色
e.Cell.BackColor = System.Drawing.Color.Yellow;
}

status = e.GetValue("BOM_FLAG").ToString();
if (status == "N")
{
//一些不需设置颜色的列
if (e.DataColumn.Caption.ToString() == "计划确认标识") return;
if (e.DataColumn.Caption.ToString() == "BOM转换") return;
if (e.DataColumn.Caption.ToString() == "库房确认标识") return;
if (e.DataColumn.Caption.ToString() == "是否分配流水号") return;
if (e.DataColumn.Caption.ToString() == "三方要料") return;
if (e.DataColumn.Caption.ToString() == "库房要料") return;
if (e.DataColumn.Caption.ToString() == "三方物料接收状态") return;
if (e.DataColumn.Caption.ToString() == "库房发料接收状态") return;
if (e.DataColumn.Caption.ToString() == "生产确认标识") return;
if (e.DataColumn.Caption.ToString() == "柳汽标识") return;
if (e.DataColumn.Caption.ToString() == "改制返修是否转BOM") return;

//给需要设置颜色的列设置颜色
e.Cell.BackColor = System.Drawing.Color.Green;
}

sql = " select plan_code from ms_sfjit_plan_log where gzdd IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = ‘ "
+ theUserId + "‘ AND PROGRAM_CODE = ‘" + theProgramCode + "‘ AND COMPANY_CODE = ‘" + theCompanyCode + "‘) "
+ " and plan_code=‘" + tJhdm + "‘ ";
dc.setTheSql(sql);
dt = dc.GetTable();
if (dt.Rows.Count > 0)
{
//给需要设置颜色的列设置颜色
if (e.DataColumn.FieldName.ToString() == "PLAN_CODE")
{
e.Cell.BackColor = System.Drawing.Color.FromArgb(128, 128, 64);
}
}

sql = " select plan_code from ms_kfjit_plan_log where gzdd IN (SELECT PLINE_CODE FROM VW_USER_ROLE_PROGRAM WHERE USER_ID = ‘ "
+ theUserId + "‘ AND PROGRAM_CODE = ‘" + theProgramCode + "‘ AND COMPANY_CODE = ‘" + theCompanyCode + "‘) "
+ " and plan_code=‘" + tJhdm + "‘ ";
dc.setTheSql(sql);
dt = dc.GetTable();
if (dt.Rows.Count > 0)
{
//给需要设置颜色的列设置颜色
if (e.DataColumn.FieldName.ToString() == "PLAN_SO")
{
e.Cell.BackColor = System.Drawing.Color.FromArgb(255, 0, 255);
}
}

sql = " select SO from atpusofjb where so=‘" + tJhso + "‘ ";
dc.setTheSql(sql);
dt = dc.GetTable();
if (dt.Rows.Count < 0)
{
//给需要设置颜色的列设置颜色
if (e.DataColumn.FieldName.ToString() == "PRODUCT_MODEL")
{
e.Cell.BackColor = System.Drawing.Color.FromArgb(0, 123, 123);
}
}

//string status = e.GetValue("RUN_FLAG").ToString();
//if (status == "N")
//{
// //第0列RMES_ID
// object c0 = e.DataColumn.Caption;
// //e.Cell.BackColor = System.Drawing.Color.Red;
// //第1列Command列
// //object c1 = e.Row.Cells[1];
// ////第2列 计划序
// //object c2 = e.Row.Cells[2];
// ////第3列 计划代码
// //object c3 = e.Row.Cells[3];
// ////第4列 生产线代码
// //object c4 = e.Row.Cells[4];
// //e.Row.Cells[0].BackColor = System.Drawing.Color.Red;
// //e.Row.Cells[1].BackColor = System.Drawing.Color.Red;
// //e.Row.Cells[2].BackColor = System.Drawing.Color.Red;
// //e.Row.Cells[3].BackColor = System.Drawing.Color.Red;
// //e.Row.Cells[4].BackColor = System.Drawing.Color.Red;

// if (e.DataColumn.Caption.ToString() == "计划代码")
// {
// e.Cell.BackColor = System.Drawing.Color.Red;
// }
//}
}

时间: 2024-10-23 22:16:49

ASPxGridView改变列颜色的相关文章

锐浪 报表, 交叉报表中 对交叉字段,做条件改变背景颜色 .

var fieldCount = Report.RunningDetailGrid.ColumnContent.ContentCells.Count; // 总字段列数 var lockFieldCount = Report.DetailGrid.CrossTab.ListCols; // 锁定字段列数 var crossFieldCount = fieldCount - lockFieldCount; for(var colIndex = 1; colIndex <=crossFieldCou

bash中通过设置PS1变量改变提示符颜色

参考 <Prompt Magic> ubuntu初始时bash提示符的颜色同程序输出的颜色相同,当大量有输出时,找到输出信息开始的地方往往很费劲.如果把提示符的颜色变成更为醒目的颜色,那么就很容易定位输出信息开始处.bash中想要改变提示符颜色可以通过PS1变量的值来设置,如果将其放入用户对应目录下的.bashrc文件中,则用户打开bash时自动更改颜色.这里,我将提示符改成绿色:    PS1="\[\e[32m\]\[email protected]\h:\w\$ \[\e[0m

在mysql中,如何改变列声明.

C 在mysql中,如何改变列声明. 修改表 - 修改列名 使用 CHANGE COLUMN 来修改列的名字,还必须 设置 列的数据类型 mysql> desc test_tab -> // +-------+-------------+------+-----+---------+-------+ | Field | Type        | Null | Key | Default | Extra | +-------+-------------+------+-----+-------

【转】使用blend改变图片颜色

最近对Core Animation和Core Graphics的内容东西比较感兴趣,自己之前也在这块相对薄弱,趁此机会也想补习一下这块的内容,所以之后几篇可能都会是对CA和CG学习的记录的文章. 在应用里一个很常见的需求是主题变换:同样的图标,同样的素材,但是需要按照用户喜爱变为不同的颜色.在iOS5和6的SDK里部分标准控件引入了tintColor,来满足个性化界面的需求,但是Apple在这方面还远远做的不够.一是现在用默认控件根本难以做出界面优秀的应用,二是tintColor所覆盖的并不够全

OpenCV改变像素颜色

Mat src=imread("image/color.jpg"); imshow("a",src); int i,j; int cPointR,cPointG,cPointB,cPoint;//currentPoint; for(i=1;i<src.rows;i++) for(j=1;j<src.cols;j++) { cPointB=src.at<Vec3b>(i,j)[0]; cPointG=src.at<Vec3b>(i,

jquery改变背景颜色

jquery改变背景颜色<html><head><script type="text/javascript" src="/jquery/jquery.js"></script><script type="text/javascript">$(document).ready(function(){  $("button").toggle(function(){    $

ALV行 列颜色设置

ALV的颜色设置分为3种:行.列.单元格. 1.列颜色的设置 在 slis_t_fieldcat_alv-emphasize 中,写入需要的颜色代码. Eg: DATA: fc TYPE slis_t_fieldcat_alv WITH HEADER LINE. fc-tabname = 'ITAB'. fc-fieldname = 'COL'. fc-emphasize = 'C100'. append fc. 2.行颜色的设置 a.在要输出的 itab 中,加入 color 列,类型为C(4

jquery动态改变背景颜色插件

GETHUB下载地址 背景颜色用animate方法时时无法改变颜色的 所以要使用插件进行补充. 用法: <!DOCTYPE html> <html> <head> <style> div { background-color: #bada55; width: 100px; border: 1px solid green; } </style> <script src="http://code.jquery.com/jquery-1

改变状态栏颜色

要改变状态栏颜色的前提条件这个是让颜色显示 info.plist中 View controller-based status bar appearance这个属性 View controller-based status bar appearance =NO 统一设置(但是只有三中系统的)在plist里增加一行 UIStatusBarStyle(或者是“Status bar style”也可以) 单独设置  白色[UIApplication sharedApplication].statusBa