This code was working properly before, basically I have a master page that has a single text box for searching, I named it searchBox
. I have a method to pull the content of searchBox
on form submit and set it to a variable userQuery
. Here is the method:
Public Function searchString(ByVal oTextBoxName As String) As String
If Master IsNot Nothing Then
Dim txtBoxSrc As New TextBox
txtBoxSrc = CType(Master.FindControl(oTextBoxName), TextBox)
If txtBoxSrc IsNot Nothing Then
Return txtBoxSrc.Text
End If
End If
Return Nothing
End Function
The results are displayed on search.aspx
. Now, however, if searchBox
is filled and submitted on a page other than search.aspx
, the contents of the text box are not passed through. The form is very simple, just:
<asp:TextBox ID="searchBox" runat="server"></asp:TextBox>
.
<asp:Button ID="searchbutton" runat="server" Text="search" UseSubmitBehavior="True" PostBackUrl="~/search.aspx" CssClass="searchBtn" />