ASPxGridview根據條件將合格行顏色改變

來源:互聯網
上載者:User
protected void ASPxGridView1_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e)        {            if (e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return;            int s = (int)e.GetValue("TeaID");            if (s > 1001)                e.Row.ForeColor = Color.Red;        }   根據條件將合格行顏色改變          protected void ASPxGridView1_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)        {                        //int s = (int)e.GetValue("TeaID");            //if (s > 1001)            //    e.Cell.ForeColor = Color.Red;        }       protected void ASPxGridView1_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)    {        string itemCode = e.GetValue("ITEM_CODE").ToString();        if (itemCode == "100024")        {            e.Cell.BackColor = System.Drawing.Color.Green;        }    }    protected void ASPxGridView1_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e)    {        if (e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return;        string invalid_date = e.GetValue("INVALID_DATE").ToString();        string currentDate = System.DateTime.Now.ToShortDateString().ToString();        if (invalid_date != null &&invalid_date != "")//非複驗項目,有近效期和失效期        {            if (Convert.ToDateTime(invalid_date) <= Convert.ToDateTime(currentDate))            {                e.Row.BackColor = System.Drawing.Color.Red;            }        }    }       protected void ASPxGridView1_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)    {        if (e.DataColumn.FieldName == "LEFTMONEY")        {            if (float.Parse(e.CellValue.ToString()) < 0)            {                e.Cell.ForeColor = System.Drawing.Color.Red;            }        }    }    //改變當前處理行的顏色     protected void ASPxGridView1_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)    {        if (e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return;        string ispick = e.GetValue("IsPromotion").ToString();        if (ispick == "1")        {            e.Row.ForeColor = System.Drawing.Color.Red;        }    }       初始化自訂按鈕,按條件顯示     protected void workGrid_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e)    {        ASPxGridView grid = sender as ASPxGridView;        if (ASPxGridView1.DataSource == null) return;        string status = grid.GetRowValues(e.VisibleIndex, "WORK_STATUS").ToString();        if (status != "未完成")        {            e.IsVisible = DevExpress.Utils.DefaultBoolean.False;        }    }

  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.