How to call the button1_click method from button2_click? Is it possible?
It can be fully triggered by a button click event, but this is bad practice. Move the code from your button to a separate method. For instance:
protected void btnDelete_OnClick(object sender, EventArgs e) { DeleteItem(); } private void DeleteItem() {
This strategy makes it easy for you to directly access your code without the need for any event handlers. In addition, if you need to pull the code from your code behind and into a separate class or DLL, you are two steps ahead of you.
source share