DoSearch twice

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
10/19/2008 7:51:26 AM
Gravatar
Total Posts 59

DoSearch twice

Hi, joe

In File SearchResults.aspx,  Function DoSearch() will be called twice with the same query string, as below:

private void Page_Load(object sender, EventArgs e)
{

...

this.query = this.txtSearchInput.Text;

if (this.query != string.Empty)
{

////////////First time begin//////////////////////
DoSearch();

///////////First time end////////////////////////
}
else
{
ShowNoResults();
}

.......
}

private void btnDoSearch_Click(object sender, EventArgs e)
{
this.query = this.txtSearchInput.Text;

////////////Second time begin////////////////////
DoSearch();

////////////Second time end////////////////////

}

I think better delete the copy in Page_Load.

thanks!

10/20/2008 11:45:44 AM
Gravatar
Total Posts 18439

Re: DoSearch twice

Hi,

Thanks for pointing that out. The one in PageLoad is only needed when its a cross page postback from another page, not when the search button on the page is clicked. I will fix it like this:

if (Page.PreviousPage != null)
{
if (this.query != string.Empty)
{
DoSearch();
}
else
{
ShowNoResults();
}
}

Cross page postback occurs if the skin (layout.master) has the SearchInput control set to LinkOnly=false (see styleshout-refresh skin for example). When configured like this there is a search input on every page instead of just a link to the search page and when a user searched using this input a cross page postback is made to the search results page. If its not a cross page postback then Page.PreviousPage will be null.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.