网页上查询学生不及格信息状态显示为红色
//GridView设置显示数据
 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
                        Font-Size="9pt" ForeColor="#333333">
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <Columns>
                            <asp:BoundField DataField="res_id" HeaderText="学生编号" />
                            <asp:BoundField DataField="stuname" HeaderText="学生姓名" />
                            <asp:BoundField DataField="stusex" HeaderText="学生性别" />
                            <asp:BoundField DataField="which_lesson" HeaderText="考试科目" />
                            <asp:BoundField DataField="taotiname" HeaderText="考试套题" />
                            <asp:BoundField DataField="res_total" HeaderText="考试成绩" />
                            <asp:BoundField DataField="res_subdate" HeaderText="考试时间" />
                        </Columns>
                        <RowStyle BackColor="#EFF3FB" />
                        <EditRowStyle BackColor="#2461BF" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
//加载绑定数据库数据
SqlConnection sqlcon;
    string strCon = ConfigurationManager.AppSettings["conStr"];
    protected void Page_Load(object sender, EventArgs e)
    {
        string sqlstr = "select * from tb_StuResult";//定义查询语句
        sqlcon = new SqlConnection(strCon);//创建数据库连接
        SqlDataAdapter myda = new SqlDataAdapter(sqlstr,sqlcon);//创建数据适配器
        DataSet myds = new DataSet();//创建数据集
        myda.Fill(myds,"tb_StuResult");//填充数据集
        GridView1.DataSource = myds;//设置数据源
        GridView1.DataBind();//绑定数据
        for (int i = 0; i <= GridView1.Rows.Count - 1; i++)//遍历控件
        {
            DataRowView mydrv = myds.Tables["tb_StuResult"].DefaultView[i];
            string score = Convert.ToString(mydrv["res_total"]);
            if (Convert.ToInt32(score) < 60)//判断res_total值即学生成绩如果小于60分为不及格
            {
                GridView1.Rows[i].Cells[5].BackColor = System.Drawing.Color.Red;//成绩不及格时单无格显示红色
            }
        }
    }