开发者

Multiple Update Panels In a Datalist. Can't Add Trigger

开发者 https://www.devze.com 2023-01-07 20:49 出处:网络
My issues here is that this does not compile. I get \"A control with ID \'LinkButtonRemove\' could not be found for the trigger in UpdatePanel \'UpdatePanelFiles\'.\"

My issues here is that this does not compile. I get "A control with ID 'LinkButtonRemove' could not be found for the trigger in UpdatePanel 'UpdatePanelFiles'."

What I am trying to do is have two buttons in the item template. One that updates just the ITEM and one that updates the entire DataList. "LinkButtonRemove" is what I want to update the entire datalist. Any ideas on why this isnt working? Or how to do what I want to do?


THE SHORT VERSION:
UPDATEPANEL1
-DATALIST
--ITEM
---UPDATEPANEL2
----CONTROLS

I want one control to update the item updatepanel only and the other to update the entire datalist.


       <asp:UpdatePanel ID="UpdatePanelFiles" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="LinkButtonRemove" />
            </Triggers>
            <ContentTemplate>
                <asp:DataList ID="DataListFiles" class="MediaManagerDataList" runat="server" ItemStyle-BackColor="#ffffff" AlternatingItemStyle-BackColor="#E7F4FF" OnItemCommand="DataListFiles_ItemCommand">
                    <ItemTemplate>
                     开发者_如何学C   <asp:UpdatePanel ID="UpdatePanelItem" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <div class="item">
                                    <asp:LinkButton ID="LinkButtonRemove" CommandName="remove" runat="server">Remove</asp:LinkButton>
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </ItemTemplate>
                </asp:DataList>
            </ContentTemplate>
        </asp:UpdatePanel>


The updatepanel can't see the button, but it can see the list. You can skip the trigger part and just call updatepanel.update() in your codebehind when you handle the click event.


You can do this by putting the DataList's Id instead of the linkbutton

0

精彩评论

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