Full postback triggered by LinkButton inside GridView inside UpdatePanel

前端 未结 8 839
余生分开走
余生分开走 2020-12-02 13:22

I have a GridView inside of a UpdatePanel. In a template field is a button I use for marking items. Functionally, this works fine, but the button always triggers a full page

8条回答
  •  自闭症患者
    2020-12-02 13:40

    I had an issue where I had one form working fine (page1), another doing whole post backs (page2). Turned out when I made the 2nd page, I had done a bit too much cut/paste, and it still had a javascript call in the form definition.

    < form id="form1" runat="server" onsubmit="return checkstuff();">
    

    But checkstuff was not defined in page 2.

    deleted the onsubmit, and the partial posts started working.

    In the working page - page 1, checkstuff was defined, but was just a stub, which did nothing more than return true. Just for grins, I put an alert in checkstuff, and sure enough, it is called for all submits, partial or not. And, if I changed the stub to just return false, nothing happened at all.

    Point in all this, the javascript is still exercised, as if a full page is being submitted. So double check your client side scripts.

提交回复
热议问题