-2

I have some little problem with jQuery, I want to disable this jQuery, I've tried anything to do it like I disable use tag DIV, and PANEL from server side but not working, this is my jQuery I want to disable:

//To show or hide button select
 $("[ID*=DivText]").click(function() {
  $(this).next("[ID*=DivImgSelect]").css("display", "block");
  $(this).prevAll("[ID*=hdnFooter]").val("True");
  $(this).prevAll("[ID*=hdnText]").val("True");
  $(this).css("display", "none");
  });
  $("[ID*=DivImgSelect]").click(function() {
  $(this).prevAll("[ID*=DivText]").css("display", "block");
  $(this).prevAll("[ID*=hdnFooter]").val("False");
  $(this).prevAll("[ID*=hdnText]").val("False");
  $(this).css("display", "none");
   });

and this is my tag asp while used jquery:

<ItemTemplate>
 <asp:Panel ID="DisplayFlags" runat="server" Enabled ="true">
 <div id="DivTextInbox" runat="server" class="outerDiv" style='<%#  DataBinder.Eval(Container.DataItem, "InboxFlag").ToString()=="True" ? "display:none": "display:block" %>'>
<a class="LinkText">
    <asp:Label ID="spanLinkInbox" CssClass="LinkText" Style="cursor: pointer" ForeColor="blue" runat="server" Text="Not Allowed "></asp:Label></a>
</div>
<div id="DivImgSelectInbox" runat="server"  class="imageSelected" style='<%# DataBinder.Eval(Container.DataItem, "InboxFlag").ToString()=="True" ? "display:block": "display:none" %>'>
                                                                       <asp:Image runat="server" ID="imgSelectInbox" ImageUrl="~/Images/check.png" Width="16px"
                                                                        Style="cursor: pointer" />
                                                                  </div>
                                                                  </asp:Panel>
                                                                </ItemTemplate>

2 Answers2

9

just make use of this below code i guess u'll get the answer

$("[ID*=DivImgSelect]").off('click');

to use it backend side just use as below..

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", 
         "<script type='text/javascript'>$('[ID*=DivImgSelect]').off('click');
                                                            </script>", false);
The Hungry Dictator
  • 3,444
  • 5
  • 37
  • 53
2

I didnt try it but

you can unbind event like this from client side

$( "#foo" ).unbind();

but I guess u wanna do that from server side then register this script

something like this

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>youcode here</script>", false);
sakir
  • 3,391
  • 8
  • 34
  • 50