javascript - Click Event Unbinded after Server Side Call -
i'm facing issue on click event of button. kindly have @ following javascript code.
$(function () { uploadbtndisableevents(); function uploadbtndisableevents() { var buttonupload = $('#' + '<%= imgbtndocupload.clientid %>'); var txtfile = $('#' + '<%= filupload.clientid %>'); var txtname = $('#' + '<%= txtdocname.clientid %>'); buttonupload.on('click', function () { validatecontrols(txtfile, txtname)) { settimeout(function () { buttonupload.prop('disabled', true); buttonupload.removeattr('href'); }, 10); } }); var validatecontrols = function (file, docname) { var inputname = docname.val(); var inputfile = file.val(); if (inputname == "" || inputfile == null || inputfile == "" || inputfile == null) { return false; } else { return true; } } } });
this code works when intially page loaded. when user click on upload button, button disabled , server call intiated. in code behind @ end of button click button again re-enabled. it's purpose stop user clicking button again. when user click on delete button click event bound using .on event unbinded , when user again clicks on upload button, not disabled. kindly give me suggestions. way on delete complete page reloaded why it's not rebinding button event. thanks.
note : kindly if require more information mention in comments. controls have used anthem controls ajax call purpose.
well after lot of hard work got solution of question. in case of callback happened complete dom not loaded did have registered uploadbtndisableevents function. here line have wrote on callback button click.
clientscript.registerstartupscript(me.gettype(), "javascript", "javascript: disablecontrols(); ", true)
above code re-register script when callback completes.
Comments
Post a Comment