can't get jquery livequery to with an update panel

Posted by Jeremy on Stack Overflow See other posts from Stack Overflow or by Jeremy
Published on 2010-05-03T17:13:55Z Indexed on 2010/05/03 17:18 UTC
Read the original article Hit count: 545

Filed under:
|
|
|

I have some basic html inside an asp.net update panel. Using livequery, I set up autocomplete, blur and keydown events so that they all continue to be wired up after the update panel does a partial page load. When the page initially loads, all the events work fine but after the update panel does a partial page reload, none of the events wired up with livequery continue to work. Are there known issues with livequery and update panels?

Html:

<asp:UpdatePanel ID="upData" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:DataList ID="dlData" runat="server"
            DataSource='<%# this.Data %>' DataKeyField="ID">
            <ItemTemplate>
                <table>
                    <tr>
                        <th class="required">Location</th>
                        <td><asp:TextBox ID="txtFromLocation" MaxLength="10" CssClass="searchlocation fromlocation required" runat="server" Text='<%# Eval("FromLocation")%>'/><asp:RequiredFieldValidator ID="rvalFromLocation" runat="server"
            ControlToValidate="txtFromLocation" ValidationGroup="leg">*</asp:RequiredFieldValidator></td>
                    </tr>
                </table>
            </ItemTemplate>
        </asp:DataList>
     </ContentTemplate> </asp:UpdatePanel>

And then I have my javascript. Normally it has a bunch of other code, but I can reduce it down to this and still have the problem:

$(document).ready(function() {
    $(".searchlocation").livequery(function() {                       
        $(this).keydown(function(event) {alert('test');});   
    });
});

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about livequery