论坛里没有人给我冒泡,我自己研究了半天解决了- <asp:TemplateField HeaderText="ID">
- <ItemTemplate>
- <asp:Label ID="lbID" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
- </ItemTemplate>
- </asp:TemplateField>
复制代码 int id = int.Parse(((Label)(ShowList.Rows.Cells[1].FindControl("lbID"))).Text.ToString());
或者- <asp:BoundField DataField="ID" HeaderText="ID" />
复制代码 int id = int.Parse(ShowList.Rows.Cells[2].Text.ToString()); |