日期:2014-05-18 浏览次数:20506 次
<asp:GridView ID="GridView1" runat="server" DataKeyNames="id" OnSelectedIndexChanging="GridView1_SelectedIndexChanging"> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="Name" HeaderText="Name" /> </Columns> </asp:GridView>
------解决方案--------------------
//非编辑状态 string signName = this.gvSignUp.Rows[e.RowIndex].Cells[0].Text.Trim(); //编辑状态 string realCharge = ((TextBox)this.gvSignUp.Rows[e.RowIndex].Cells[2].Controls[0]).Text.Trim();
------解决方案--------------------
如果用的简单绑定GridView1.SelectedRow.Cells[0].Text
如果用的模版列,里面放了控件,要获取控件值
TextBox b = (TextBox)(GridView1.SelectedRow.FindControl("textbox1"));
string aa = b.Text;