question

EdikaKediri-2405 avatar image
0 Votes"
EdikaKediri-2405 asked Bruce-SqlWork commented

asp.net Button event fired without __EVENTTARGET and __EVENTARGUMENT

I've made an asp.net website base on bootstrap and I have problem with some asp.net button that not fire the linked server event on iphone/ipad with safari. It is not a javascript/browser problem, because all the javascript on the page is working correctly. I cannot debug iphone/ipad because there is a not a debugger on safari for the device, but I can debug the reuqet on the server, and the only things I've notcie is that in the Request.Form.AllKeys sent by iphone/ipad is missing the one from the asp.net button. That's why the server event is not fired. Here is a Request.Form.AllKeys coming from a windows/android device:

Request.Form.AllKeys
{string[14]}
[0]: "__VIEWSTATE"
[1]: "__VIEWSTATEGENERATOR"
[2]: "__EVENTVALIDATION"
[3]: "ctl00$pageContent$txtname"
[4]: "ctl00$pageContent$txtdesc"
[5]: "ctl00$pageContent$hincredits"
[6]: "ctl00$pageContent$txtprice"
[7]: "ctl00$pageContent$txtcurr"
[8]: "ctl00$pageContent$chkautorenew"
[9]: "ctl00$pageContent$hautorenew"
[10]: "ctl00$pageContent$txtrenewprice"
[11]: "ctl00$pageContent$txtcredits"
[12]: "ctl00$pageContent$txtdays"
[13]: "ctl00$pageContent$btnSave"
and this id the one from iphone/ipad

Request.Form.AllKeys
{string[13]}
[0]: "__VIEWSTATE"
[1]: "__VIEWSTATEGENERATOR"
[2]: "__EVENTVALIDATION"
[3]: "ctl00$pageContent$txtname"
[4]: "ctl00$pageContent$txtdesc"
[5]: "ctl00$pageContent$hincredits"
[6]: "ctl00$pageContent$txtprice"
[7]: "ctl00$pageContent$txtcurr"
[8]: "ctl00$pageContent$chkautorenew"
[9]: "ctl00$pageContent$hautorenew"
[10]: "ctl00$pageContent$txtrenewprice"
[11]: "ctl00$pageContent$txtcredits"
[12]: "ctl00$pageContent$txtdays"

How the event is handled on the server without the __EVENTTARGET and __EVENTARGUMENT parameters? Note that in this page the __doPostBack script is not rendered but the server event is triggered correctly in Windows and Android.

As you can see in the second one is missing the line 13, the one I think should fire the server event. Is it changed something in how asp.net manage the server event defined in WebControls?

In all the pages where the server event are managed with the classic __doPostBack funtcion the event is triggered also in the iPhone/Ipad device. Whe the _doPostBack is missing the server event is not triggered.

dotnet-aspnet-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

the __EVENTTARGET and __EVENTARGUMENT parameters are only used for a javascript initiated post backs. if the button is clicked, the browser includes the button name in the form post data.

the iPad/iphone code must be doing a form.submit() on the click. maybe some validation code? you can remote debug with a mac.

another quick option is to add a command arg to the button. this will force the __dopostback() render for the button.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

EdikaKediri-2405 avatar image
0 Votes"
EdikaKediri-2405 answered Bruce-SqlWork commented

Thank you Bruce for your explanation.
I still do not understand why the submit from ipad / iphone is still done without including the name of the button. The form in question uses jquery validator. Who takes care of inserting the button name in the postback?

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Jquery validation is supposed to add a hidden field with the button name. You would need to debug.

1 Vote 1 ·