Datagrid行颜色根据内部值而变化 [英] Datagrid row color change depending on inner value

查看:68
本文介绍了Datagrid行颜色根据内部值而变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我想要使用Datagrid(而不是GridView)

我已经填写了一个单选按钮列表,用于说明选择选项[确定]或[注记],现在我想在单选按钮列表选择值[注记] ...时使用bgcolor ...

当使用[notok]进行记录保存时,然后在Datagrid中以该行背景色显示为红色.

Sorry ,i want in Datagrid (and not GridView)

I have one radiobuttonlist filled that remarks select option [ok] or [notok], now i want bgcolor when radiobuttonlist select values [notok]...

when record save with [notok] then display data in Datagrid with this row backgroung color as Red.

推荐答案

请参见

在发布查询之前,请从下一次清除!

您去了:
Please be clear from next time before posting the query!

Here you go:
//Something similar to this
protected void DataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
     CheckBox cbx = (CheckBox)e.Row.FindControl("checkBoxID");
     if (cbx != null)
     {
         if (cbx.Checked)
         {
            // This will change back color of the grid row
            e.Row.BackColor = System.Drawing.Color.Red;
         }
     }
}


最后,请读一本书!做Google会立即给您带来不同的事件!


Lastly, please read a book! Doing Google would had given you the difference of events immediately!


这篇关于Datagrid行颜色根据内部值而变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆