ms_dos

  博客园  :: 首页  :: 新随笔  ::  :: 订阅 订阅  :: 管理
突出显示成绩cj表(id,english,computer)中学生不及格的分数
1。突出显示不及格分数所在行
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataRowView drv;
        if(e.Row.RowType==DataControlRowType.DataRow)
        {
            drv = e.Row.DataItem as DataRowView;
            if (Convert.ToInt32(drv["computer"].ToString()) < 60 || Convert.ToInt32(drv["english"].ToString()) < 60)
                e.Row.BackColor = System.Drawing.Color.Red;
        }
    }
2。突出显示不及格分数所在单元格
    protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (Convert.ToInt32(e.Row.Cells[1].Text) < 60)
                e.Row.Cells[1].BackColor = System.Drawing.Color.Red;
            if (Convert.ToInt32(e.Row.Cells[2].Text) < 60)
                e.Row.Cells[2].BackColor = System.Drawing.Color.Red;
        }               
    }
posted on 2007-07-24 23:20  ms_dos  阅读(1081)  评论(0编辑  收藏  举报