During my initial page creation I generate a row of textboxes as the first row of my GridView that the user can enter search criteria in. Now when the user presses the Search button a postback occurs and I then need to read the values from my textboxes to perform the search and only return the requested resuts to the GridView
Now because the textboxes don't get created until the GridView.DataBind() call as the first empty row gets inserted into the DataTable once the results have been obtained and the search boxes are added to the empty row during the OnRowCreated event. This means that when I try and get my values from the textboxes they don't yet exist so can't do
value = ((TextBox)row.Cells[i].Controls.Text;
I do know is that the search boxes were previously named txtSearch0, txtSearch1 etc.
so I could say value = txtSearch0.Text;
and the value will be obtained from ViewState but is there a way of doing something like this:
for(int i = 0; i < noSearchBoxes; i++)
value = txtSearch + ["i"].Text;