前台:
<asp:GridView ID="GV" runat="server" AutoGenerateColumns="False" Height="1px"
            Style="z-index: 100; left: 8px; position: absolute; top: 8px" Width="800px" CellPadding="4" Font-Size="Small" ForeColor="#333333" AllowSorting="True">
            <Columns>
                <asp:TemplateField HeaderText="人员编码">
                    <ItemTemplate>
                    <a href="#" onclick="ShowValue(this);"><%#Eval("人员编码")%></a>
                    </ItemTemplate>
                    <ItemStyle Width="80px" />
                </asp:TemplateField>
                <asp:BoundField DataField="姓名" HeaderText="姓名" >
                    <ItemStyle Width="60px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="出勤工日" >
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="小计" >
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="病假" >
                    <ItemStyle Width="15px" Wrap="True" />
                </asp:BoundField>
                <asp:BoundField HeaderText="事假">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="婚假">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="产假">
                    <ItemStyle HorizontalAlign="Right" Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="丧假">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="探亲假">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="年休假">
                    <ItemStyle Width="15px" Wrap="True" />
                </asp:BoundField>
                <asp:BoundField HeaderText="看护假">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="节育假">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="工伤假">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="迟到早退">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="本月扣分">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="累计扣分">
                    <ItemStyle Width="15px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="摘要">
                    <ItemStyle Width="100px" />
                </asp:BoundField>
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#EFF3FB" />
            <EditRowStyle BackColor="#2461BF" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>请问:第一列控件好像没有id,后台要怎样才能遍历gridview所有记录并获取第一列模板列"人员编码"的值,请大侠提供vb.net后台代码

解决方案 »

  1.   


            String _ids = "";
            for (int i = 0; i < Gridview1.Rows.Count; i++)
            {
                    _ids+= int.Parse(Gridview1.Rows[i].Cells[1].Text) + ",";
            }
      

  2.   


      protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            string id = GridView1.Rows[e.NewEditIndex].Cells[0].Text;
            Response.Redirect("TempletEdit.aspx?id=" + id);
        }