3

I've just implemented a small UpdatePanel with a button outside the panel that modifies the controls within it. Per instructions here and here I have set up a trigger on Page_Load that looks like this...

UpdatePanel1.Triggers.Add(item: new AsyncPostBackTrigger
{
    ControlID = Button1.UniqueID
});

...in order to allow the button click event to update the panel asynchronously (it was refreshing the whole page before). However, now it works asynch the first time, but every other click after that triggers a whole page refresh. I'm pretty confused by that one. Can anyone spot what's wrong? (Edit: To clarify, the following represents the refresh results of a series of clicks starting after page load: Asynch (good), Whole Page (bad), Asynch, Whole Page, Asynch, Whole Page, etc...)

FYI the form is ASP.NET 4.0 and resides in a SharePoint 2013 visual web part, if that matters.

Community
  • 1
  • 1
thanby
  • 323
  • 1
  • 6
  • 22
  • 2
    Consider change your code to the `aspx` file. Maybe you are doing it in the wrong time. doing it in the `aspx` solve some of those problems. – Vitor Canova Aug 15 '14 at 19:45
  • @VitorCanova I'll try your suggestion. What is the difference as far as sequencing goes? – thanby Aug 18 '14 at 11:52
  • 1
    I already had a lot of problems by doing some thing in the wrong method (probably not your case) or in the wrong place in the so used `IsPostBack` `if` statement. When defined in the `aspx` file ASP.NET guarantee it will be called when need, in the moment it is needed and nothing more. – Vitor Canova Aug 18 '14 at 11:57
  • 1
    @thanby, Doing it declaratively (in your aspx) makes sure that the value is assigned at the correct time. If you assign it in your code-behind (i.e. Page_Load) you're overriding that default behavior (which might end up in you NOT assigning it at the correct time). – Saturn K Jan 06 '15 at 00:22

1 Answers1

2

try scriptmanager EnablePartialRendering property like this

<asp:ScriptManager ID="ScriptManager1" runat="server" EnableViewState="False" EnablePartialRendering="true"> </asp:ScriptManager>

volkan
  • 103
  • 2