event capturing or bubbling

Posted by ChampionChris on Stack Overflow See other posts from Stack Overflow or by ChampionChris
Published on 2010-12-24T20:44:21Z Indexed on 2010/12/24 20:54 UTC
Read the original article Hit count: 268

I have a link button in a repeater control. the li element is drag and droppable using jquery. when the page loads the the link button works perfectly, the jquery that is attached and the server side code both execute. when I perform a drag and drop then click on the link button it doesn't not fire. when i click it a second time it does fire. If i perform 2 or drag and drops in a row the link button doesn't fire a as many drag and drops as i before it will fire. for example if if perform 3 drag and drops then it will take about 3 click before the events are fired.

<asp:Repeater ID="rTracks" runat="server" OnItemDataBound="rTracks_ItemDataBound" EnableViewState="true">
                <ItemTemplate>
                    <li onclick="testclick();" class='admin-song ui-selectee <asp:Literal id="ltStatusClass" runat="server" />' mediaid="<%# Eval("MediaId") %>" artistid="<%# Eval("tbMedia.tbArtists.id") %>"><span class="handle"><strong>
                        <%--<%# int.Parse(DataBinder.Eval(Container, "ItemIndex", "")) + 1%>--%><%# Eval("SortNumber")%></strong><%--0:03--%></span> <span class="play"><span class="btn-play">&nbsp;</span></span> <span class="track" title="<%# Eval("tbMedia.Title") %>">
                            <%# Eval("tbMedia.Title") %></span> <span class="artist">
                                <%# Eval("tbMedia.tbArtists.Name") %></span> <span class="time" length="<%# Eval("tbMedia.Length") %>">
                                    <asp:Literal ID="ltRuntime" runat="server" /></span> <span class="notes"><span class="btn-notes">
                                        <asp:Literal ID="ltNotesCount" runat="server" /></span></span> <span class="status">
                                            <asp:Literal ID="ltStatus" runat="server" /></span> <span class="date">
                                                <%# Eval("DateAdded") %></span> <span class="remove"><asp:LinkButton ID="lbStatusClass2" runat="server" CssClass="btn-del" OnClick="UpdateStatus" ValidationGroup='<%#Bind("MediaId") %>'>
                                                    <%--<span class='<asp:Literal id="ltStatusClass2" runat="server" Text="btn-del" />'>--%>
                                                    &nbsp;<%--</span>--%></asp:LinkButton></span></span> </li>
                </ItemTemplate>
            </asp:Repeater>

I have onclick event on the li element, when the mouse is clicks the link button the li onclick event is fired even when linkbutton event doesnt fire. My question is if the li captures the event y doesnt the event fire on the linkbutton? What would be stopping the event?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET