tags:

views:

273

answers:

1

I have a master page and have included a search text box.

User is on default.aspx

user enters a search value in the search text box, which is part of master page.

Via javascript the form, in MP, is submitted to my search functionality page, search.aspx and the code behind search.aspx.cs obtains the form post and gets the data.

Search.aspx has a bare bone table to display the results.

I have a breakpoint in search.aspx.cs and am able to see the raw results returned from DB. However after all databinding has occured, the user is not directed from default.aspx to search.aspx

+1  A: 

Don't use any javascript to submit the form, just set the PostBackUrl property of your search button to Search.aspx:

<asp:TextBox ID="TxtSearch" runat="server" />
<asp:LinkButton 
    ID="BtnSearch" 
    runat="server" 
    PostBackUrl="Search.aspx" 
    Text="Search" />

And in the Page_Load of Search.aspx read the posted value:

protected void Page_Load(object sender, EventArgs e)
{
    string searchText = Request["TxtSearch"];
}
Darin Dimitrov
Darin: Why would POstBackURL work as opposed to javascript
ltech
I haven't seen the javascript you are using so it is difficult to answer.
Darin Dimitrov
Here is the js post:function DoSearch(SearchString){ document.forms['TestForm'].Search.value = SearchString; alert('This is working so far..'); document.forms['TestForm'].submit();}
ltech