如题:  数据库:
  ID    name  password  Role
  1     admin  admin    1
  2     aaa    aaa      0
(1是管理员,0是普通用户)GridView 里面自带的删除!
   可是admin也能删   我怎么让用户不能删除管理员类?

解决方案 »

  1.   

    把0写进隐藏字段里,
       删除的时候判断!
      可以写js脚本判断!
     也可以在后台代码中判断!
       最好在js脚本中判断!
      当为管理员是取消删除!
      

  2.   

      我找到解决的了!
       
      在DAL里面
    public static IList<AdminUsers> GetAdmins()
    {
    }
    sql语句判断一下
      sql = "select * from AdminUser where UserRole=0";
    就不让管理员显示出来!
      

  3.   

    row_Deleting 事件里
    {
      if(GridView1.Rows[e.RowIndex].Cells[管理员所在列的索引].Text==1)
      {
        e.Cancel = true;
      }
    }