本帖最后由 vagxin 于 2009-08-18 10:37:23 编辑

解决方案 »

  1.   


                                <asp:TemplateField HeaderText="aa">
                                 <ItemTemplate>
                                      <asp:Label ID="aa" runat="server" Width="50px" Text='<%#Bind("aa") %>'></asp:Label>
                                </ItemTemplate>
                                  </asp:TemplateField>For i As Integer = 0 To GridView1.Rows.Count - 1
                Dim row As GridViewRow = GridView1.Rows(i)
                Dim aa as string=""
               aa=DirectCast(row.Cells(0).FindControl("aa"), Label).Text 
                End If
                Conn.Close()
            Next
      

  2.   

    这个好像是获取Text吧,在显示的时候Text和字段名称是不一样的
      

  3.   

    可以获取到的,那个gridview不是有索引和主键不?
    你可以通过这两种方式中的一种就可以拿到了
    好像是这样grivew.rows[当前行的索引].cell[你要拿的列的索引]
      

  4.   

    这样grivew.rows[当前行的索引].cell[你要拿的列的索引]的方法 我能能获取Text 但是DataField获取不到
      

  5.   

    看见一个牛人大概是这样写的string result=null;
    foreach (DataControlField col in this.GridView1.Columns)
        if (col is BoundField)
        {
            var col1 = (BoundField)col;
            result = col1.DataField;    }