ASP .NET Controlling updatepanel from repeater button in another updatepanel

ajaxasp.netupdatepanel

I have two update panels, the first update panel (up1) contains a repeater control which simply repeats a button control. When one of the buttons is clicked in up1, i simply want to update the second update panel (up2) using a paramater passed from the button in up1.
Basically, each button has a conversation ID, so when clicked up2 will get all the messages from a conversation with that id. Because of other functionality, there needs to be two update panels.

<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" EnablePartialRendering="true" runat="server" >
</asp:ScriptManager>
<asp:UpdatePanel runat="server" ID="up1" OnLoad="up1_Load">
    <ContentTemplate>
        <asp:Repeater ID="Repeater1" runat="server">
            <ItemTemplate>
                <asp:Button ID="Button1" runat="server"
                    CommandName="conversationID" 
                    CommandArgument='<%# Eval("conversation_id") %>' />
             </ItemTemplate>
        </asp:Repeater>
    </ContentTemplate>
</asp:UpdatePanel>

<asp:UpdatePanel ID="up2" runat="server">
    <ContentTemplate>
        <asp:Repeater ID="Repeater2" runat="server">
            <ItemTemplate>
                <p><%#Eval("message")%></p>
            </ItemTemplate>
        </asp:Repeater> 
    </ContentTemplate>
</asp:UpdatePanel>

I've tried passing command arguments in the code behind but it just doesn't work! Please can someone point me in the right direction?

Many thanks

Best Answer

Look up AsyncPostBackTriggers as a way to get a clientside control to trigger an UpdatePanel to do a partial page refresh. I've tied two update panels together that way many times...

<UpdatePanel>
   <Triggers>
     <asp:AsyncPostBackTrigger ControlID=”up1” />
   </Triggers>
   <ContentTemplate>
     ....
   </ContentTemplate>
</UpdatePanel>

I don't remember offhand whether you can link the actual UpdatePanels together or if you'll have to add a trigger rule for every repeater button in your up1 UpdatePanel

Related Topic