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

Discussion in 'ASP .Net' started by panik, Dec 4, 2003.

  1. panik

    panik Guest

    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
     
    panik, Dec 4, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jorge
    Replies:
    2
    Views:
    1,290
    jorge
    May 26, 2004
  2. Ben Fidge
    Replies:
    5
    Views:
    749
    S. Justin Gengo
    Jun 15, 2004
  3. Asaf
    Replies:
    1
    Views:
    714
  4. jorge
    Replies:
    1
    Views:
    424
    Teemu Keiski
    May 28, 2004
  5. Moksha

    Button Click on a User Control Not getting fired

    Moksha, Aug 27, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    177
    Brian Fulford
    Aug 27, 2004
Loading...

Share This Page