Answered Button Click Event runs twice from search screen

  • Tuesday, April 17, 2012 10:30 AM
     
     

    Hi,

    I have created a custom button (Audit) on the detail screen of lightswitch. Now, when I click this button directly from my detail screen, it functions normarly. But, if I create a search screen, search the ID of activity, and view it in the same detail screen, and now click this button, the "CanExecute" and "Execute" method runs twice. When I click this button first time,  the "CanExecute" & "Execute" method executes but nothing happens. When I click this button second time, both the "CanExecute" & "Execute" method runs again and perform the desired functionality.

    Any suggestions, how can we avoid button double click issue through search screen?

All Replies

  • Friday, April 20, 2012 2:04 AM
    Moderator
     
     

    When I click this button first time,  the "CanExecute" & "Execute" method executes but nothing happens.

    Wouldn't that mean you are doing nothing in your user code on this first click? You'll have to explain in more detail as to what the problem is and probably provide the code for the *_CanExecute and *_Execute methods.

    Justin Anderson, LightSwitch Development Team

  • Friday, May 11, 2012 6:39 PM
     
     Answered

    Hi All,

    I was able to solve this issue by writing all code lines inside dispatcher on my button_execute code.

    • Marked As Answer by AnuragMathur Friday, May 11, 2012 6:39 PM
    •