__dopostback Is Not Defined
Solution 1:
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);
Solution 2:
If the page doesn't have a control that causes a postback, __doPostBack() won't be output as a function definition. One way to override this is to include this line in your Page_PreRender():
this.Page.ClientScript.GetPostBackEventReference(<a control>, string.Empty);
This function returns a string calling __doPostBack(); but also forces the page to output the __doPostBack() function definition.
Solution 3:
Here's why this was happening to me: I accidentally forgot that script tags must always have closing tags:
<scriptsrc="/Scripts/appLogic/Regions.js" />
I corrected the script tag:
<scriptsrc="/Scripts/appLogic/Regions.js"type="text/javascript" ></script>
and sanity returned.
Solution 4:
Just add this code to your .aspx
<asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager>
Solution 5:
__doPostBack()
should be automatically included by any ASP.NET WebControl that could cause a post back. You sound like you are calling it manually in some Javascript you wrote. If so, you will need to include a WebControl, to make sure that function in inserted onto the page.
Post a Comment for "__dopostback Is Not Defined"