protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (e.Row.Cells[4].Text == "0")
            {
                e.Row.Cells[4].Text = "未审核";
            }
            else 
            {
                e.Row.Cells[4].Text = "<font color=red>已审核</font>";
            }
            ((LinkButton)(e.Row.Cells[6].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
        }
    }

解决方案 »

  1.   

    绑定GridView时判断如果数据行的第五列中是"0",则显示"未审核",否则显示红色的"已审核";再在第7列里找到LinkButton为之加上删除确认
      

  2.   

    ...这个怎么解释. 
    如果e的Row的RowType==DataControlRowType的DataRow?
    ...
      

  3.   

    如果GridView1的每行的第5列即e.Row.Cells[4]的值为0,则赋值(显示)为“未审核”,否则就显示为“已审核”
    另外给每行的第七列即e.Row.Cells[6]控件的单击事件加上确认提示。
      

  4.   

      protected   void   GridView1_RowDataBound(object   sender,   GridViewRowEventArgs   e)
    //看这方法名, 应该是让 GridView 在绑定数据事件时触发该方法
            {
                    if   (e.Row.RowType   ==   DataControlRowType.DataRow)
    //是否如果控件类型相符
                    {
                            if   (e.Row.Cells[4].Text   ==   "0")
                            {
    //是否如果该行的第5列(0是第一列)的文本为 0
                                    e.Row.Cells[4].Text   =   "未审核";
    //该行文本设置为 "未..."
                            }
                            else  
                            {
                                    e.Row.Cells[4].Text   =   " <font   color=red> 已审核 </font> ";
    //该行文本设置为 "已...", 而且是红色字字, 这个FONT已是过时了, 建议使用<span style="color:red"></span>
                            }
                            ((LinkButton)(e.Row.Cells[6].Controls[0])).Attributes.Add("onclick",   "return   confirm('确定删除吗?')");
    //为该行的第7列的第一个控件添加 onclick 事件, 内容为点击触发时, 弹出消息框, 内容是"确定..吗?", 消息框类型是选择消息框.
                    }
            }okay?!
      

  5.   

    TO:特别是最后一行代码.......请以注释的方试,在右边写出.谢谢
    -----------------------
    ((LinkButton)(e.Row.Cells[6].Controls[0])).Attributes.Add("onclick",   "return   confirm('确定删除吗?')"); 
    e.row.cells[6].controls[0]//表示该行的行7列的第1个控件.
    ((LinkButton)(e.Row.Cells[6].Controls[0]))
    //这一行多余了一对括号, 写成 ((LinkButton)e.Row.Cells[6].Controls[0])就行了.
    //意思是将 该行的行7列的第1个控件 强制转换为 LinkButton 类型.
    .....Attributes.Add("onclick",   "return   confirm('确定删除吗?')"); 
    //为控件的属性添加一个名为 onclick, 内容为 return   confirm('确定删除吗?')
    // onclick 是点击事件
    // confirm 是JAVASCRIPT默认函数, 将是弹出确认消息框.//---------------楼主需要好好学习基础.okay?!