locked
Listview itemtemplate jquery in Updatepanel--rebinding on partial postback RRS feed

  • Question

  • User-1242214802 posted

    Hi All: I have a listview in an updatepanel, which uses jQuery in the edititemtemplate to display tabbed data, show/hide divs, etc. I'm able to rebind the jquery scripts after a partial postback using " Sys.WebForms.PageRequestManager.getInstance().add_endRequest();" outside the updatepanel.

    I also have some jquery embedded in the "itemTemplate" of the listview, where I assign the control IDs dynamically, e.g. to show/hide a comments div in each individual row:

    <div style="margin-top: 0.5em">Comment:
    	<asp:HyperLink runat="server" ID="hladd" Text="add" NavigateUrl="#" /> |
    	<asp:HyperLink runat="server" ID="hlviewComments" Text="view all" NavigateUrl="#" /></div>
    		<asp:Panel runat="server" ID="pnlComment">
    			<asp:TextBox runat="server" ID="txtComment" TextMode="MultiLine" Rows="3" />
    		</asp:Panel>
    </div>
            $('#<%#Container.FindControl("pnlComment").ClientID%>').hide();
    
            $('#<%#Container.FindControl("hladd").ClientID%>').click(function (e) {
                $('#<%#Container.FindControl("pnlComment").ClientID%>').slideToggle("slow");
                var val = $(this).text() == "hide" ? "add" : "hide";
                $(this).hide().text(val).fadeIn("slow");
                e.preventDefault();
            });
    

    How do I reload this code for multiple rows after a partial postback?

    Thursday, January 11, 2018 2:12 PM

All replies