Preventing multiple call to button's event handler
-
hi, i have added a button in windows datagrid. it works fine when i load the grid first time and click the button. but if i reload the datagrid again on some event and i click the button, its click handler is called twice. if i again load the grid then the click handler is called thrice. how can i correct this ? i want to call the button's click handler only once like in normal application.
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
-
hi, i have added a button in windows datagrid. it works fine when i load the grid first time and click the button. but if i reload the datagrid again on some event and i click the button, its click handler is called twice. if i again load the grid then the click handler is called thrice. how can i correct this ? i want to call the button's click handler only once like in normal application.
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
Somewhere in your code you used AddHandler to wire up the Click events of the button. Before you reload the data into the grid, use RemoveHandler to unwire those buttons before you destroy them.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
hi, i have added a button in windows datagrid. it works fine when i load the grid first time and click the button. but if i reload the datagrid again on some event and i click the button, its click handler is called twice. if i again load the grid then the click handler is called thrice. how can i correct this ? i want to call the button's click handler only once like in normal application.
Regards, Kapil Thakur (Where's there is Kapil , there is a way) - thakur.kapil@gmail.com
or you can use module level boolean variable to check wether the button is already clicked :)