__doPostBack is not defined

后端 未结 26 2039
不知归路
不知归路 2020-12-09 08:12

Im getting that error when try to call a __doPostBack on one of my pages, every page that i have in the project use __doPostBack function but in this particular page im gett

相关标签:
26条回答
  • 2020-12-09 08:36

    __doPostBack Works guys

    Write this code in Page Load

    ClientScript.GetPostBackEventReference(this, "");

    0 讨论(0)
  • 2020-12-09 08:38

    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.

    0 讨论(0)
  • 2020-12-09 08:39

    I was getting this because my script was inside an Iframe that was being "disposed" (it was a Telerik "window" that was closed). The code defining _dopostback() inside my iframe was gone, but the code calling _dopostback() inside my iframe was still hanging around. Love that JavaScript!

    0 讨论(0)
  • 2020-12-09 08:40

    i had this error and i solved it by inserting :

    <form runat="server" style="display: none"></form>
    
    0 讨论(0)
  • 2020-12-09 08:40

    It is __doPostBack function not found error. Put one button in page and set its usersubmitbehavior=false, then run and see viewsource, you will have __doPostBack function automatically be added in your page.

    Now put your own html button which you want to make postback from and call __doPostBack function by setting its onclick="__doPostBack('mybut','save')".

    Now the __doPostBack function required for your html button is given by the above button.

    0 讨论(0)
  • 2020-12-09 08:41

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

    <form runat="server">
    </form>
    
    0 讨论(0)
提交回复
热议问题