Server.Transfer in User Control only fired on second click on button

P

panik

Hi,

I have a Control, a SearchBox class, that is derived from UserControl.
It is placed inside another UserControl (a page structure) that is placed
inside a custom page class (derived from Page).
All controls are added programmatically (Controls.Add())

In the SearchBox Control, I have an ImageButton, with an
ImageClickEventhandler attached to it. The EventHandler is defined in the
SearchBox class.

I placed two lines in the ImageClickEventhandler for the search button:
1. a Response.Write to give me feedback
2. a Server.Transfer to let the page you're on switch to the search results
page.

The Response.Write is fired on each click. The Server.Transfer is only fired
when you click a second time on the button.

The scenario goes like this:
You open the homepage.
You click Search but get the Homepage back (the url remains default.aspx)
You click again and get the searchresults page. (the url switches to
search.aspx or whatever the searchresult page's URI is)

How is this happening? I tried to catch errors, but didn't get any.
Is the only way to use this SearchBox control on every single page in an
asp.net application to define an additional html form element with the
searchresults page as action attribute?

thanks for your help,
Vincent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top