Happy Pig's - 哼哼
开开心心每一天,勤勤奋奋过日子。
         在数据源没有数据的时候:
         DataSet ds = new DataSet();
            ds =...
            DataTable dt = ds.Tables[0];
            if (dt.Rows.Count <= 0)
            {
                DataRow dr = dt.NewRow();
                dt.Rows.Add(dr);
            }
            this.GridView1.DataSource = dt;
            GridView1.DataBind();
     
        在点击按钮新增一行的时候
       DataSet ds = new DataSet();
         ds = ....
        DataTable dt = ds.Tables[0];
        if (dt.Rows.Count >= 0)
        {
            DataRow dr = dt.NewRow();
            dt.Rows.Add(dr);
        }
        this.GridView1.DataSource = dt;
        GridView1.DataBind();
posted on 2007-04-10 17:47  boulder  阅读(3796)  评论(0)    收藏  举报