Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 278 Vote(s) - 3.42 Average
  • 1
  • 2
  • 3
  • 4
  • 5
__doPostBack is not defined

#11
The run time/client side error `__doPostBack` is undefined hassled me for a few hours. There was lots of misleading/incorrect help on the net. I inserted the following line of code in the `Page_Load` event of the `default.aspx.cs` file and everything worked fine, on my system and in production with GoDaddy.

ClientScript.GetPostBackEventReference(this, string.Empty);
Reply

#12
I had this problem when I wrote my own page code and forgot to put `runat="server"` on the form element.
Reply

#13
Another addition to this vintage thread....

I had these symptoms while developing a site using JQuery Mobile, and it turned out that it was caused by the link I followed to the affected page not having the `rel="external"` attribute set on it.

This meant that JQuery loaded the contents of the new page via AJAX, and 'injected' them into the current page, rather than reloading the whole thing, and hence the required postback javascript wasn't present until a full page refresh.

Reply

#14
# __doPostBack Works guys #


### Write this code in Page Load ###
ClientScript.GetPostBackEventReference(this, "");
Reply

#15
Just add this code to your .aspx

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
Reply

#16
Old question but recent answer: if you have a `ScriptManager`, check if `EnablePartialRendering` is enabled. If so, disable it, I don't know why it's a problem there...
Reply

#17
I had this problem and sometimes its just stupidity. I wrote it as __doPostback with a lowercase'b', where it should have been __doPostBack with an uppercase 'B'.
Reply

#18
Essentially what's going on is that there are 2 missing html hidden elements "eventtarget"
and "eventargument", as well as a missing function "__doPostBack".

These are missing from the DOM.

I tried all the fixes listed for this and none worked. However using a combination of jquery and javascript there is an unobtrusive solution. Add this to your javascript on document ready and you're off to the races (This is a much quicker alternative than installing the .net framework 4.5 on your server, although if you can install 4.5 thats the way to go):

if ($('#__EVENTTARGET').length <= 0 && $('#__EVENTARGUMENT').length <= 0) {
$('#YOUR_ASPNET_FORMID').prepend('<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />');
}

if (typeof __doPostBack == 'undefined') {
__doPostBack = function (eventTarget, eventArgument) { object
var theForm = document.forms['YOUR_ASPNET_FORMID'];
if (!theForm) {
theForm = document.YOUR_ASPNET_FORMID;
}
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
};
}

I understand that some of said installing 4.5 fixes this. I would definitely recommend that. However, if you're like me working on an enterprise public facing site with a cms system baked in .net 4, this might just be an easier solution, as opposed to possibly introducing new bugs created from updating your platform.
Reply

#19
For me it was the following was missing from the page:

<form runat="server">
</form>
Reply

#20
i used this method in my script that included to asp.net form:

main form id sample:
<script src="myscript" />

<form id="frmPost" runat="server">
</form>

// myscript.js in java script function
mypostboack: function () {
$('#frmPost').context.forms[0].submit()
}
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through