Created a button in my aspx file and add its click method in the in my cs file.
When i run the aspx file my button calls its click method, but when i remove the protected access modifier from its click method then it shows undefined method error.
Why is this so?
Because when you remove the
protectedaccess modifier and you do not specify any other modifier,privateis assumed, and click handlers cannot be private. They must at least be protected because ASP.NET generates at runtime a class that derives from the page you have defined and it needs to be able to call its base methods.