Reputation: 43
function my_page_start_onload() {
if (__doPostBack) { // Error: '__doPostBack' is undefined
...
}
}
window.onload = my_page_start_onload();
I have tried many ways but with no luck.
Browser Definition Updated (aspnet_regiis.exe -i and iisreset) -> see http://forum.jdp.tw/thread-1552-1-1.html -> Added browser definition to C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\Browsers\ie.browsers -> RUN C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regbrowsers.exe -i -> RUN iisreset -> still error
Try to install hotfix, but occurs an error The update is not applicable to your computer
Try to install .NET Framework, but occurs an error The update is not applicable to your computer
VS2012 with .NET 4.5 to run this function with blank page, still error
All versions of IE5-11, still error
Remarks:
InternetExplorer
11.0
Computer Environment
Many thanks for help!
Upvotes: 0
Views: 2971
Reputation: 3952
Postback function will be automatically generated for you by .NET if your page contains some control that requires postback, but don't normally cause postback. Consider a submit button - it causes postack, but don't need additional js code because it's designed to cause postback. However, controls like linkbutton (rendered as anchor) or dropdownlist don't normally cause postback that's why asp.net will generate __postback function for them. So in order to force asp.net to generate _postback function you can add to page some dummy control or you can make <form> tag runat=server or if you want to include __postback function in every page no matter what controls they contrains you can execute this function in your master page Page_Load event:
ClientScript.GetPostBackEventReference(this, "");
Upvotes: 1