<FooterTemplate>
<asp:TextBox ID="txtSName" runat="server" Text=""/>
</FooterTemplate>
和代码隐藏代码如下:
TextBox txtName = (TextBox)(GridView1.FooterRow.FindControl("txtSName"));
string aa=txtName.Text;
每次aa
都是null
。
此代码我将进行以下操作:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
}
请帮帮我..........
答案 0 :(得分:1)
尝试此代码可能有效:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
TextBox txtName = GridView1.FooterRow.FindControl("txtSName") as TextBox;
string aa = txtName.Text;
}
答案 1 :(得分:0)
试试这个:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
TextBox txtName = (TextBox)e.Item.FindControl("txtSName");
}
让我知道它是否有效。您是否将此用于add/update
记录?