Skip to content

How to restrict callback event in c#

sr

Asked Jun 30, 2013, 10:32 PM EDT8 answers
Share
LinkedInX
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

8 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Have you enabled AutoPost=true for your checkbox control?
    0
  • 0
    Hi Murali, i am populating checkbox control dynamically with checkbox list control's autopostback property set as false. in code behind page load there were 2 conditions one for callback and other for page load first time, i would like to skip callback event on mouse click
    0
  • Sunny  Sharma
    0
    Hello sr,

    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!
    0
  • 0
    Hi Sunny thanks but i believe it disables click button everywhere i want to disable click button in area outside check box list control of the web page
    0
  • Sunny  Sharma
    0
    No it won't. It will only disable the click event on document, give that a try. Rest controls are on top of the Document so they won't get affected.
    0
  • 0
    Hi Sunny,
    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?
    0
  • 0
    Hi murali, i am adding controls from database which in turn call checkboxlist which is a seperate class, i have a common page where there are 2 methods !this.iscallback and else conditions with my intention not to call else condition on mouse click on page which is not happening with code given by sunny which surprises me.
    0
  • Sunny  Sharma
    0
    Hi sr,

    Can you show me your code that is generating the checkboxes dynamically? It will be much of help to help you.
    0