Javascript wont do a postback from c# code in asp.net

前端 未结 1 822
猫巷女王i
猫巷女王i 2021-01-29 05:27

Ok managed to get the code working, as in no errors but it wont do a post back after ive confirmed when I click on the div?:



        
1条回答
  •  走了就别回头了
    2021-01-29 05:51

    The problem is because __doPostBack is not defined. It's not defined because you didn't put any control on your page that is a an IPostBackEventHandler, like LinkButton is.

    In order to Page.IsPostBack to be true, you have to either:

    • Re-archtecture your application so that you implement a control that implements IPostBackEventHandler and, of course, put it on your page
    • You put a dummy IPostBackEventHandler on your page. One that doesn't do anything. Like a LinkButton.

    Either way ASP.NET will define the __doPostBack function at client side and your code will finally postback

    0 讨论(0)
提交回复
热议问题