What is the difference between the button.click event and the button.command event?

What is the difference between Button.Click Event and Button.Command Event in asp.net?

+6
source share
2 answers

As the documentation suggests, the Button.Command event allows you to specify a “command” so that you can distinguish which button is pressed, etc.

+6
source share

The Click and Command buttons behave the same. Both will perform the PostBack operation and have a slight difference.

  • If the button has the Click and Command events associated with it, then the eventHandler event is executed first, then the CommandHandler command is executed.

  • The Click event does not pass any parameters, while the command will send parameters such as CommandName and CommandAgrument to codeBehind code. . In this way, it helps developers find which button is triggered when they have multiple buttons.

0
source share

All Articles