且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从gridview到数据库的多行数据...

更新时间:2023-12-04 12:56:58

bool firstTime = true;

   System.Data.DataTable dt;
   protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
   {
       if (e.Row.RowType == DataControlRowType.DataRow)
           if (this.firstTime)
           {
               System.Data.DataView dv =
                    (e.Row.DataItem as System.Data.DataRowView).DataView;
               this.dt = dv.ToTable();
               this.Label1.Text = dt.Rows.Count.ToString();
               this.firstTime = false;
           }