AutoGenerateColumns="true" 你是自动生成的列吗

解决方案 »

  1.   

    如果没有数据,给Datagrid插入一空白行吧
      

  2.   

    在数据绑定之前这样做:
    SqlDataAdapter da = new SqlDataAdapter(strSql, myConn);
    DataSet ds = new DataSet();
    da.Fill(ds);DataTable myTable = ds.Tables[0];
    string a = myTable.Columns[1].Caption;
    //绑定到GridView
    GridView1.DataSource = ds;
    GridView1.DataBind();
    红色部分就是楼主需要的!!
      

  3.   

    if (e.Item.ItemType == ListItemType.Header)   
      TextBox txt = (TextBox)e.Item.FindControl("textbox")   
      string TextValue = txt.Text;
    这样行了吧~~获取页眉TEXTBOX的植
      

  4.   

    我用的是asp.net(vb)的,如果不是用这种语言的请不要写你的答案!!谢谢