how do i determine what event caused postback

Discussion in 'ASP .Net' started by TS, Nov 28, 2005.

  1. TS

    TS Guest

    Is there a way in debug mode to determine what event caused the postback to
    occur without having an event handler for that event?

    thanks
     
    TS, Nov 28, 2005
    #1
    1. Advertising

  2. TS

    Karl Seguin Guest

    If it's a button, the ClientId of the control will be in the REquest.Form
    collection.

    Any control which does postback via javascript (textBox, linkbutton,
    dropdownlist) will have the id in the __EVENTTARGET of the request.form
    collection.

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/
    http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!



    "TS" <> wrote in message
    news:...
    > Is there a way in debug mode to determine what event caused the postback
    > to occur without having an event handler for that event?
    >
    > thanks
    >
     
    Karl Seguin, Nov 28, 2005
    #2
    1. Advertising

  3. TS

    TS Guest

    Ok, i have proven your two statements - i did not know this :)

    But, i have a postback that occurred by hitting the enter key and posting
    back, but the eventtarget is "" and the button on the form is not in the
    request.form collection.

    What other ways is a form submitted that will explain this? This all leads
    to my discussion of why my click event is not executing on the server even
    though the form is getting posted back (Re: hitting enter button while in
    textbox calls correct button's click...)

    Thanks for all the input, i can say i've learned something!

    "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    wrote in message news:...
    > If it's a button, the ClientId of the control will be in the REquest.Form
    > collection.
    >
    > Any control which does postback via javascript (textBox, linkbutton,
    > dropdownlist) will have the id in the __EVENTTARGET of the request.form
    > collection.
    >
    > Karl
    >
    > --
    > MY ASP.Net tutorials
    > http://www.openmymind.net/
    > http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!
    >
    >
    >
    > "TS" <> wrote in message
    > news:...
    >> Is there a way in debug mode to determine what event caused the postback
    >> to occur without having an event handler for that event?
    >>
    >> thanks
    >>

    >
    >
     
    TS, Nov 28, 2005
    #3
  4. Ya, sometimes the enter key doesn't cause the button to click like you might
    think it should.

    You could use this free control to solve the problem.
    http://www.metabuilders.com/tools/DefaultButtons.aspx

    And here are a couple good articles on the subject:
    http://www.allasp.net/enterkey.aspx
    http://www.aspnetpro.com/features/2004/06/asp200406so_f/asp200406so_f.asp

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net


    "TS" <> wrote in message
    news:...
    > Ok, i have proven your two statements - i did not know this :)
    >
    > But, i have a postback that occurred by hitting the enter key and posting
    > back, but the eventtarget is "" and the button on the form is not in the
    > request.form collection.
    >
    > What other ways is a form submitted that will explain this? This all leads
    > to my discussion of why my click event is not executing on the server even
    > though the form is getting posted back (Re: hitting enter button while in
    > textbox calls correct button's click...)
    >
    > Thanks for all the input, i can say i've learned something!
    >
    > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    > wrote in message news:...
    >> If it's a button, the ClientId of the control will be in the REquest.Form
    >> collection.
    >>
    >> Any control which does postback via javascript (textBox, linkbutton,
    >> dropdownlist) will have the id in the __EVENTTARGET of the request.form
    >> collection.
    >>
    >> Karl
    >>
    >> --
    >> MY ASP.Net tutorials
    >> http://www.openmymind.net/
    >> http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!
    >>
    >>
    >>
    >> "TS" <> wrote in message
    >> news:...
    >>> Is there a way in debug mode to determine what event caused the postback
    >>> to occur without having an event handler for that event?
    >>>
    >>> thanks
    >>>

    >>
    >>

    >
    >
     
    Steve C. Orr [MVP, MCSD], Nov 28, 2005
    #4
  5. TS

    TS Guest

    thank you sir.

    FYI. I couldn't get these solutions to work, but i did run across one that
    did: in IE 5/6 you must have at least 2 textboxes on the form and it will
    work, so you just hide the extra "dummy" control.

    thanks

    "Steve C. Orr [MVP, MCSD]" <> wrote in message
    news:%...
    > Ya, sometimes the enter key doesn't cause the button to click like you
    > might think it should.
    >
    > You could use this free control to solve the problem.
    > http://www.metabuilders.com/tools/DefaultButtons.aspx
    >
    > And here are a couple good articles on the subject:
    > http://www.allasp.net/enterkey.aspx
    > http://www.aspnetpro.com/features/2004/06/asp200406so_f/asp200406so_f.asp
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://Steve.Orr.net
    >
    >
    > "TS" <> wrote in message
    > news:...
    >> Ok, i have proven your two statements - i did not know this :)
    >>
    >> But, i have a postback that occurred by hitting the enter key and posting
    >> back, but the eventtarget is "" and the button on the form is not in the
    >> request.form collection.
    >>
    >> What other ways is a form submitted that will explain this? This all
    >> leads to my discussion of why my click event is not executing on the
    >> server even though the form is getting posted back (Re: hitting enter
    >> button while in textbox calls correct button's click...)
    >>
    >> Thanks for all the input, i can say i've learned something!
    >>
    >> "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    >> wrote in message news:...
    >>> If it's a button, the ClientId of the control will be in the
    >>> REquest.Form collection.
    >>>
    >>> Any control which does postback via javascript (textBox, linkbutton,
    >>> dropdownlist) will have the id in the __EVENTTARGET of the request.form
    >>> collection.
    >>>
    >>> Karl
    >>>
    >>> --
    >>> MY ASP.Net tutorials
    >>> http://www.openmymind.net/
    >>> http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!
    >>>
    >>>
    >>>
    >>> "TS" <> wrote in message
    >>> news:...
    >>>> Is there a way in debug mode to determine what event caused the
    >>>> postback to occur without having an event handler for that event?
    >>>>
    >>>> thanks
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    TS, Nov 29, 2005
    #5
  6. I solved that problem by adding :
    <input type="text" style="display:none">
    to a page which only had one textbox and a submit button.

    Now, hitting the enter key inside the textbox submits the form.



    Juan T. Llibre
    ASP.NET.FAQ : http://asp.net.do/faq/
    ASPNETFAQ.COM : http://www.aspnetfaq.com/
    Foros de ASP.NET en EspaƱol : http://asp.net.do/foros/
    ======================================

    "TS" <> wrote in message news:...
    > thank you sir.
    >
    > FYI. I couldn't get these solutions to work, but i did run across one that did: in IE 5/6 you must
    > have at least 2 textboxes on the form and it will work, so you just hide the extra "dummy"
    > control.
    >
    > thanks
    >
    > "Steve C. Orr [MVP, MCSD]" <> wrote in message
    > news:%...
    >> Ya, sometimes the enter key doesn't cause the button to click like you might think it should.
    >>
    >> You could use this free control to solve the problem.
    >> http://www.metabuilders.com/tools/DefaultButtons.aspx
    >>
    >> And here are a couple good articles on the subject:
    >> http://www.allasp.net/enterkey.aspx
    >> http://www.aspnetpro.com/features/2004/06/asp200406so_f/asp200406so_f.asp
    >>
    >> --
    >> I hope this helps,
    >> Steve C. Orr, MCSD, MVP
    >> http://Steve.Orr.net
    >>
    >>
    >> "TS" <> wrote in message news:...
    >>> Ok, i have proven your two statements - i did not know this :)
    >>>
    >>> But, i have a postback that occurred by hitting the enter key and posting back, but the
    >>> eventtarget is "" and the button on the form is not in the request.form collection.
    >>>
    >>> What other ways is a form submitted that will explain this? This all leads to my discussion of
    >>> why my click event is not executing on the server even though the form is getting posted back
    >>> (Re: hitting enter button while in textbox calls correct button's click...)
    >>>
    >>> Thanks for all the input, i can say i've learned something!
    >>>
    >>> "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message
    >>> news:...
    >>>> If it's a button, the ClientId of the control will be in the REquest.Form collection.
    >>>>
    >>>> Any control which does postback via javascript (textBox, linkbutton, dropdownlist) will have
    >>>> the id in the __EVENTTARGET of the request.form collection.
    >>>>
    >>>> Karl
    >>>>
    >>>> --
    >>>> MY ASP.Net tutorials
    >>>> http://www.openmymind.net/
    >>>> http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!
    >>>>
    >>>>
    >>>>
    >>>> "TS" <> wrote in message
    >>>> news:...
    >>>>> Is there a way in debug mode to determine what event caused the postback to occur without
    >>>>> having an event handler for that event?
    >>>>>
    >>>>> thanks
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Juan T. Llibre, Nov 29, 2005
    #6
    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. Aaron Chorpenning

    Re: How to determine Control that caused Postback?

    Aaron Chorpenning, Jul 21, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    482
    Aaron Chorpenning
    Jul 21, 2003
  2. JollyK
    Replies:
    2
    Views:
    623
    alex bowers
    Dec 11, 2003
  3. Jordan
    Replies:
    3
    Views:
    3,041
    Stefan
    Aug 31, 2005
  4. Guest
    Replies:
    4
    Views:
    2,298
    PG Deep
    Jan 29, 2011
  5. Abubakar
    Replies:
    10
    Views:
    743
    Gregory A. Beamer
    Jul 30, 2009
Loading...

Share This Page