Hi Team, i have aspx page with code behind in c#,the page has checkbox list which gets pulled dynamically(not static checkbox list), now my concern is once i do the check/uncheck of checkboxes and if i left mouse button then callback is happening which is not required i have verified the code base and there is no activation of callback event from code, check box unselect/selection is fine but if you click left mouse button on any part of the aspx page callback is happening which i dont want to happen.
i do not want to raise callback event if i do mouse click on the form, i tried different options to prevent but could not succeed, can some one guide on this
Thanks
msr
How to restrict callback event in c#
8 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Former memberPosted Jun 30, 2013, 10:55 PM EDT
sr4 pointsPosted Jun 30, 2013, 11:06 PM EDT
Sunny SharmaRank #223 · 11.1K pointsPosted Jun 30, 2013, 11:23 PM EDT
how about preventing click propagation on document. If you're using jquery in your aspx page, use this script:
<script type="text/javascript">
$(document).ready(function(){
document.onclick=function(e){e.preventDefault();};
}
</script>
Hope it helps.
Cheers!
sr4 pointsPosted Jun 30, 2013, 11:46 PM EDT
Sunny SharmaRank #223 · 11.1K pointsPosted Jun 30, 2013, 11:59 PM EDT
Former memberPosted Jul 1, 2013, 12:55 AM EDT
It looks like, it will disable the click event on the document side.
Hi SR,
When you creating the new controls, it should be possible to disable the click event.
Please let me know, how you're adding the controls dynamically?
sr4 pointsPosted Jul 1, 2013, 1:29 AM EDT
Sunny SharmaRank #223 · 11.1K pointsPosted Jul 1, 2013, 1:55 AM EDT
Can you show me your code that is generating the checkboxes dynamically? It will be much of help to help you.