c# - Imagebutton causing __dopostback event of some other javascript -
i have gridview
in asp.net webforms page imagebutton
s inside updatepanel jquery ui slider buttons , textboxes pass values slider. i'm using following script slider:
$(function () { var lvalue = $(".lbllrating").text(); var rvalue = $(".lblhrating").text(); $("#slider-range").slider({ range: true, min: 0, max: 5, values: [lvalue, rvalue], slide: function (event, ui) { // showcurrenttime(); // $(".txtrng1").trigger("change"); $(".txtrng1").val(ui.values[0]); var lval = $(".txtrng1").val(); // if conditions $(".txtrng2").val(ui.values[1]); var rval = $(".txtrng2").val(); // if conditions //document.getelementbyid("<%= btnapplywt.clientid %>").click(); $('#<%= btnapplywt.clientid %>').trigger('click'); __dopostback("btnapplywt_click", "onclick"); } }); $(".txtrng1").val($("#slider-range").slider("values", 0)); $(".txtrng2").val($("#slider-range").slider("values", 1)); var lval = $(".txtrng1").val(); // if conditions } });
asp.net controls
<asp:button id="btnapplywt" runat="server" cssclass="btn btn-primary pull-right" onclick="btnapplywt_click" style="display: none;"></asp:button> <asp:textbox id="txtrng1" runat="server" cssclass="pull-right txtrng1" ontextchanged="ontxt_textchanged" autopostback="true" style="display: none;"></asp:textbox> <asp:textbox id="txtrng2" runat="server" cssclass="pull-right txtrng2" ontextchanged="ontxt_textchanged" autopostback="true" style="display: none;"></asp:textbox>
this working fine expected.
however, main issue imagebutton
s inside gridview. while clicking on image button inside gridview, ontxt_textchanged
event being called instead of imagebutton click event @ first click. imagebutton click event working fine until full postback (refresh page manually).
anyone has idea what's going wrong? please let me know if need provide additional details.
the following 2 line cause ontextchanged event fired before onclick.
$(".txtrng1").val($("#slider-range").slider("values", 0)); $(".txtrng2").val($("#slider-range").slider("values", 1));
Comments
Post a Comment