UpdatePanels and AsyncPostbackTrigger

Last post 08-15-2008 9:51 AM by ltklein. 7 replies.

Sort Posts:

  • UpdatePanels and AsyncPostbackTrigger

    07-17-2007, 4:32 PM
    • Loading...
    • SuperGhost
    • Joined on 12-29-2005, 11:58 AM
    • Palmdale CA, USA
    • Posts 404

    I'm having an issue with UpdatePanels (UP). I have a few UP's on my page that are linked via UP Triggers corresponding to different actions between the UP's. I have one UP that plays a video and sets some other information.

    I then have another UP with a DataList containing LinkControls. Each LinkControl will update a SQL Query and is wired to the video UP by the "Command" event. I dynamically set the AsyncPostbackTrigger on each LinkControl via the DataList's "OnItemDataBound" event.

    The problem is that when I click the LinkControls my video panel does not update. Here is my code to wire the controls:

    // Add postback trigger
    AsyncPostBackTrigger ap = new AsyncPostBackTrigger();
    ap.ControlID = lnkControl.UniqueID;
    ap.EventName = "Command";
    upFMV.Triggers.Add(ap);

    I verify that the triggers are added and even though the button's Command event fires, the video UpdatePanel does not update.

    I've manually added the upFMV.Update() call within the LinkControl and that works, but why will it not work when I dynamically bind the trigger?

    ** Hope this helps!

    DennyDotNet.com
  • Re: UpdatePanels and AsyncPostbackTrigger

    07-17-2007, 5:10 PM
    Answer

    Did you try without specifying the EventName for AsyncTrigger?

    Long Live .NET
    Kazi Manzur Rashid (Amit)
    _________________________
    http://weblogs.asp.net/rashid/
  • Re: UpdatePanels and AsyncPostbackTrigger

    07-17-2007, 8:31 PM
    • Loading...
    • SuperGhost
    • Joined on 12-29-2005, 11:58 AM
    • Palmdale CA, USA
    • Posts 404

    That works fine. Now I'm curious as to why... Was it because I was specifying the wrong Event? If so, how do I find out which event I need to target?

    ** Hope this helps!

    DennyDotNet.com
  • Re: UpdatePanels and AsyncPostbackTrigger

    07-17-2007, 10:08 PM
    • Loading...
    • gt1329a
    • Joined on 06-23-2002, 8:53 PM
    • Atlanta
    • Posts 1,708
    For purposes of an async trigger, I think "Click" is the event you need to use.
  • Re: UpdatePanels and AsyncPostbackTrigger

    07-18-2007, 12:29 PM
    • Loading...
    • SuperGhost
    • Joined on 12-29-2005, 11:58 AM
    • Palmdale CA, USA
    • Posts 404

    I tried using Click as the event name however it did not work. My LinkButton has a OnCommand event registered so I thought Command was the correct event. Here's my control:

    <asp:LinkButton ID="lnkDisplayName" runat="server" CssClass="dispname" 
    Text='<%# Eval("DisplayName") %>' CommandArgument='<%# Eval("Id") %>'
    ToolTip='<%# Eval("DisplayName") %>' OnCommand="lnkDisplayName_OnCommand" />
    ** Hope this helps!

    DennyDotNet.com
  • Re: UpdatePanels and AsyncPostbackTrigger

    07-18-2007, 2:21 PM
    • Loading...
    • gt1329a
    • Joined on 06-23-2002, 8:53 PM
    • Atlanta
    • Posts 1,708

    Using no event, as Amit suggested, is probably fine.  I can't think of any unintended consequence of allowing all of that LinkButton's postback events to trigger partial postbacks.
     

  • Re: UpdatePanels and AsyncPostbackTrigger

    07-23-2007, 7:22 AM
    Answer

    Hi

    Use the RegisterAsyncPostBackControl instead of Triggers.Add:

    Refreshing an UpdatePanel Programmatically

    The following example shows how to refresh an UpdatePanel control programmatically. In this example, a page registers a control as a trigger by calling the RegisterAsyncPostBackControl(Control) method. The code refreshes the UpdatePanel control programmatically by calling the Update() method.

     
    I f you need more information,please let me know.
     
    Thanks
    Sincerely,
    Jin-Yu Yin
    Microsoft Online Community Support
  • Re: UpdatePanels and AsyncPostbackTrigger

    08-15-2008, 9:51 AM
    • Loading...
    • ltklein
    • Joined on 08-16-2006, 4:53 PM
    • Posts 10

    Can the asyncpostback be from a GridView update?  When I have that set the whole functionality of the GridView doesn't work - after insert through GridView I want a DetailsView to populate.

Page 1 of 1 (8 items)
Microsoft Communities
Page view counter