//声明需求变量
        String Table = "Life";
        String Fields = " LifeID as 编号";
        String MasterKey = "LifeId";
        String Filter = "";
        String Order = " order by LifeDate desc";
        int PageSize=30;
        int CurrPage =Convert.ToInt16(Request["Page"]);
        int i;
        Sql MySql=new Sql();
        DataTable Dt = MySql.SqlPageTable(Table, MasterKey, Fields, Filter, PageSize, CurrPage, Order);
        GridView1.DataSource = Dt;
        GridView1.DataBind();以上是我的代码想增加 删除 编辑 全选删除功能不知道怎么做请知道的大大 告诉谢谢..

解决方案 »

  1.   

    百度上找gridview72绝技什么都有
      

  2.   

    http://www.cnblogs.com/eecool/archive/2008/09/12/1289805.html
      

  3.   

    GridView功能很强大,这些不是很简单吗
      

  4.   

      不要用在GRIDVIEW上绑定数据源 自己手动绑定,可以在模板中添加删除或者更改按钮手写代码实现public partial class _Default : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        if(!IsPostback)
           {
            Bind();
           }
        }    private void Bind()
        {
            string str = "server=(local)\\sa;uid=sa;pwd=***;database=Libray";
            SqlConnection conn = new SqlConnection(str);
            conn.Open();
            string sqlstr = "select * from book_info";
            SqlDataAdapter da = new SqlDataAdapter(sqlstr, conn);
            DataSet ds = new DataSet();
            da.Fill(ds, "mytable");
            GridView2.DataSource = ds.Tables["mytable"];
            GridView2.DataBind();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < GridView2.Rows.Count; i++)
            {
                    CheckBox ch=this.GridView2.Rows[i].Cells[3].Controls[0] as CheckBox; //判断是否选中
                    if(ch.Checked)
                    {
                        ....
                    }
            }
        }  全选删除在模板中加个checkbox 选中后就遍历出来删除或者别的什么操作