I want my selection to work as an auto-repeat control, when something is selected, the script clicks on the button and returns the values โโof the selected values. But it does not play well with my ASP.NET Ajax and UpdatePanels. Sometimes a complete reverse transmission occurs, not a partial one.
My conclusion from my debugging is that jQuery does something behind the scenes while the break function is running. If I add a warning to stop the stop function, the partial postback works fine.
To add even more confusion, this works in IE9 and Chrome , but not in IE7 or IE8 . Thus, it may also be browser specific.
JQuery Version: v1.6.2
Script:
<script language="javascript"> $('.selectable').live("mouseover", function () { if (!$(this).data("selectable-init")) { $(this).data("selectable-init", true); $(this).selectable({ filter: '.item', stop: function () { $("#<% =btnPostback.ClientID %>").click(); } }); } }); </script>
HTML:
<div class="selectable"> <div class="item">1</div> <div class="item">2</div> <div class="item">3</div> <div class="item">4</div> </div> <asp:UpdatePanel runat="server"> <ContentTemplate> <asp:Literal ID="litIsPostback" runat="server"></asp:Literal> <asp:Button ID="btnPostback" runat="server" OnClick="btnPostback_OnClick" /> </ContentTemplate> </asp:UpdatePanel>
Code behind:
protected void btnPostback_OnClick(object sender, EventArgs e) { litIsPostback.Text = ScriptManager.GetCurrent(this).IsInAsyncPostBack.ToString(); }
source share