因为gridview的数据已经做了行转列。所以我在更新数据的时候,需要以遍历列的方式进行数据列更新。试了半天。用gridview.Columns也不行。请大家帮帮忙。

解决方案 »

  1.   

    var tb = document.getElementById("GrieViewID")//找到DataGrid
            for(var i=1;i<tb.rows.length;i++)
            { //遍歷行
                for(var j =0;j<tb.rows[i].cells.length;j++)
                {//遍歷列换一下
      

  2.   


    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                TextBox tb = (TextBox)(e.Row.Cells[0].FindControl("TextBoxID"));
                string s = tb.Text;
            }
        }
      

  3.   

    foreach(GridViewRow row in GridView1.Rows)
            {
                TextBox textBox = (TextBox) row.FindControl("textboxid");
            }
      

  4.   

     foreach (GridViewRow gvr in GridView1.Rows)
      {
        TextBox txt=(TextBox)gvr.FindControl("txtID");
        //...
      }
      

  5.   

      protected void gvCustomerGroup_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                TextBox txt1 = (TextBox)e.Row.FindControl("Textbox1");
                txt1.Text = "hello";
            }
       }
      

  6.   

    给 gridview 加个事件 protected void gvCustomerGroup_RowDataBound(object sender, GridViewRowEventArgs e) 
    代码加里面
      

  7.   

    把你模板列的textbox的ID设为txtIdfor (int i = 0; i < GridView1.Rows.Count; i++)
                {
                    if (((TextBox)(GridView1.Rows[i].FindControl("txtId"))).Checked)
                    {
                        //todo
                    }
                }
    }
      

  8.   

    hehe  take it easy 
    help you raised