Hi,
I'm developing a website with a global masterpage - this masterpage has a search box and submit button with its PostBackURL set to "Search.aspx".
When I submit the form using this button, I can easily access the text value of this search box like so:
My getter set up in the MainMasterFile.master:
1 <%@ Master Language="VB" ClassName="MainMasterFile" %>
2
3 <script runat="server">
4 Public ReadOnly Property SearchString() As String
5 Get
6 Return SearchTextBox.Text
7 End Get
8 End Property
9 </script>
In Search.aspx.vb in Page_Load:
1 If (Page.PreviousPage IsNot Nothing AndAlso PreviousPage.IsCrossPagePostBack) Then
2 searchString = CType(PreviousPage.Master, ASP.MainMasterFile).SearchString
3 Else
4 searchString = Master.SearchString
5 End If
This all works fine until I add a "repeat" search box onto Search.aspx which includes more advanced forms of searching, now I have 3 routes to loading this page:
- From another page (PreviousPage.IsCrossPagePostBack = True) using the masterpage textbox
- From Search.aspx using the masterpage textbox (PreviousPage.IsCrossPagePostBack = False)
- From Search.aspx using the page declared search textbox
Is there anyway I can differenciate routes 2 and 3? I need them to have different behaviours when Page_Load is run.
Thanks,