Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how do i determine what event caused postback

Reply
Thread Tools

how do i determine what event caused postback

 
 
TS
Guest
Posts: n/a
 
      11-28-2005
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


 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      11-28-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
TS
Guest
Posts: n/a
 
      11-28-2005
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:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      11-28-2005
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/20...200406so_f.asp

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


"TS" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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
>>>

>>
>>

>
>



 
Reply With Quote
 
TS
Guest
Posts: n/a
 
      11-29-2005
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]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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/20...200406so_f.asp
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
>
> "TS" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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:(E-Mail Removed)...
>>> 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" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> 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
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      11-29-2005
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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> 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]" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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/20...200406so_f.asp
>>
>> --
>> I hope this helps,
>> Steve C. Orr, MCSD, MVP
>> http://Steve.Orr.net
>>
>>
>> "TS" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>>> 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:(E-Mail Removed)...
>>>> 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" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> 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
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
checkboxlist - determine checkbox that caused control to fire ASP .Net 4 01-29-2011 07:10 AM
i want to find out what event caused postback Abubakar ASP .Net 10 07-30-2009 03:38 PM
How To Determine What Caused PostBack Jordan ASP .Net 3 08-31-2005 07:48 PM
HOw to find which event had occurred that caused a PostBack? JollyK ASP .Net 2 12-11-2003 11:37 AM
Re: How to determine Control that caused Postback? Aaron Chorpenning ASP .Net 0 07-21-2003 04:18 PM



Advertisments