开发者

How to make clicking on an <asp:Panel> (or a simple <div>) a trigger event for an UpdatePanel

开发者 https://www.devze.com 2023-02-11 08:39 出处:网络
I have an UpdatePanel in a Repeater. There are a few CheckBoxes in the UpdatePanel with AutoPostBack=\"true\"

I have an UpdatePanel in a Repeater.

There are a few CheckBoxes in the UpdatePanel with AutoPostBack="true"

There is a Label in the UpdatePanel. I set the Text value of the label in RepeaterName_ItemDataBound as it runs on every item generated.

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="XmlDataSource" OnItemDataBound="R1_ItemDataBound">
    <ItemTemplate>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div>
                    <asp:Label ID="DateTimeLabel2" runat="server" Text="Label"></asp:Label>
                    <asp:Panel ID="panID" CssClass="actionicon_normal actionicon_compare" runat="server">
                        <%#XPath("ID")%>
                        <asp:CheckBox ID开发者_如何学编程="chkID" runat="server" AutoPostBack="true" />
                    </asp:Panel>

                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </ItemTemplate>
</asp:Repeater>

I want the CheckBoxes to automatically update the UpdatePanel as there were no repeater around, but possibly because the OnItemDataBound does not fire on every AsyncPostBack, nothing gets updated. What is the proper way to do this?


In the onclick (JavaScript) call this function __doPostBack('idOfUpdatePanel', ''); Javascript and UpdatePanel

0

精彩评论

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