开发者

UpdatePanel refreshes only once

开发者 https://www.devze.com 2022-12-25 19:17 出处:网络
I have two updatepanels inside an accordion control, laid out like this: <accordion> <first pane content>

I have two updatepanels inside an accordion control, laid out like this:

<accordion>
   <first pane content>
      <updatepanel UpdateMode="conditional">
         <contenttemplate>...</contenttemplate>
         <triggers>...</triggers>
      </updatepanel>
   </first pane content>

   <second pane content>
       <updatepanel>
          <contenttemplate>...</contenttemplate>
          <triggers>...</triggers>
       </updatepanel>
  </second pane content>

</accordion>

The panel updates once, but after that, no updates take place. If I refresh the page, then I can see the updated information. This means that the database is being updated, but the updatepanel isn't refreshing (after refreshing the first time). Why is this happening?

This has been bugging me for days, so any advi开发者_运维百科ce would be much appreciated. Thanks!

update

The problem seems to lie when I call this:

Sys.require(Sys.components.accordion, function() {
                    $("#acca_profile").accordion({
                        HeaderCssClass: "acc_header",
                        HeaderSelectedCssClass: "acc_selectedheader",
                        FadeTransitions: true,
                        suppressHeaderPostbacks: true,
                        requireOpenedPane: false
                    });



                });

in the endRequestHandler function. However, if I don't call it, then the div that should be converted to an accordion is no longer an accordion.

Update 2

After a bit more work, I figured the problem may lie in the fact that the Jquery is not rebinding the events after the partial postback. A lot of solutions claim that you have to register the client script, but I have this at the top of my aspx page:

<asp:ScriptManager runat="server" EnablePageMethods="true">
<Scripts>

... (other script) Path="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" />

</Scripts>
</asp:ScriptManager>

How can I rebind the JQuery events in my code?


Finally, I think I've solved it! Hours down the drain for a few lines of code. Isn't that always the way? :D For people who come across this thread, I added:

Sys.Application.add_init(pLoad);

I then created a function called pLoad which contained the my accordion javascript (in original post), as well as a couple of other functions. So far things seem to be working...

0

精彩评论

暂无评论...
验证码 换一张
取 消