Gridview Empty Data template How to capture data
Posted on 2009-05-09
I have a gridview which includes a databound textbox (located in the footer of the grid) which is used to search a database, this control works prefectly using the code below to capture the search text.
Dim ProdName = TryCast(GridView3.FooterRow.FindControl("ProductSearchTB"), TextBox)
SqlDataSource4.SelectParameters("PROD_DESC").DefaultValue = ProdName.Text
My issue is this, I need to be able to run the same search from an empty Gridview, I originally tried
Dim ProdName = TryCast(GridView3.EmptyDataTable.FindControl("NewProductSearchTB"), TextBox)
SqlDataSource4.SelectParameters("PROD_DESC").DefaultValue = ProdName
But get the following error
'EmptyDataTable' is not a member of 'System.Web.UI.WebControls.GridView'.
Is there another way to capture the search text rather than using FindControl?