无法从gridview的页脚行获取文本框的值

时间:2013-10-24 09:29:07

标签: asp.net gridview vb.net-2010

其实我的问题是我想在gridview的页脚行中插入新行,同时点击gridview外面的按钮,我无法获得gridview页脚行中文本框的值

我的编码是

Dim footerRow As GridViewRow = grvTBD_LoanProducts.FooterRow
Dim sStateCode As String = TryCast(footerRow.FindControl("txtStateCode"), TextBox).Text
Dim sEntryTypeID As String = TryCast(footerRow.FindControl("txtEntryTypeID"),TextBox).Text

以上编码没有用,有助于我提前解决它

1 个答案:

答案 0 :(得分:0)

尝试此代码可能有效:

Protected Sub GridView1_RowCommand(sender As Object, e As GridViewCommandEventArgs)
    Dim txtName As TextBox = TryCast(GridView1.FooterRow.FindControl("txtStateCode"), TextBox)
    Dim aa As String = txtName.Text
End Sub