简体   繁体   中英

How to AsyncPostBackTrigger for the LinkButton in the Repeater

In my page, I have 2 repeaters.In First repeater i have a LinkButton.On Item Command of first repeater link button i am populating second repeater.I am trying to avoid postback on each click but the UpdatePanel can not avoid post back.

Here is code.aspx

<asp:ScriptManager runat="server"></asp:ScriptManager>
<div>
    <asp:UpdatePanel runat="server">
        <ContentTemplate>
            <asp:Repeater ID="rptIndvidualButtons" runat="server" onitemcommand="rptIndvidualButtons_ItemCommand">
                <ItemTemplate>
                    <ul>
                        <li class="button">
                            <asp:LinkButton ID="lnkBtnIndvidual" runat="server" Text='<%#Eval("PackageType")%>'></asp:LinkButton>
                        </li>
                    </ul>
                </ItemTemplate>
            </asp:Repeater>
        </div>
        <div style="clear:both">                  
            <asp:Repeater ID="rptIndvidual" runat="server">
                <ItemTemplate>
                    <div runat="server" id="divBronzeIndvidual">
                        <ul class="pricing-table" id="ulBronze">
                            <li class="title">
                                <div class="item-title">
                                    <asp:Label ID="lblIndvPkgName" runat="server" Text='<%#Eval("PackageName")%>'></asp:Label>
                                </div>
                            </li>
                        </ul>
                    </div>
                </ItemTemplate>
            </asp:Repeater>
        </div>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="rptIndvidualButtons" />
    </Triggers>
</asp:UpdatePanel>

From above code can any one help me??

try to call RegisterAsyncPostBackControl for the linkbuttons in rptIndvidualButtons.itemDataBound event

var lnkBtnIndvidual = (LinkButton)e.Item.FindControl("lnkBtnIndvidual")'
ScriptManager1.RegisterAsyncPostBackControl(lnkBtnIndvidual);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM