AutoEventWireup="false" and Page_Load and Overrides

In VB, creating a new page defaults AutoEventWireup="false" I've been using Handles Me.Load on the events.

Someone said I should use Overrides on the OnLoad and OnInit instead. Why?

What are they talking about? Why do that? What's the benefit? What are the settings for the AutoEventWireup if I do it that way? Leave out the Handles?

Please explain why or why not to use Handles versus Overrides.

Starr DuskkASP.NET VB.NET DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sachintana DissanayakeSenior Web DeveloperCommented:
AutoEventWireup="false", you can customize the Event name and it's required to use the event handler define an event.
    Private Sub Page_Load_Event(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Response.Write("AutoEventWireup is false")
    End Sub

With AutoEventWireup="true" , you can override the existing event that fires from the Page_Load event.

    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        Response.Write("AutoEventWireup is true")
    End Sub

In VB, AutoEventWireup set to false by default where in C# it;s set to true.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
So to override an existing event, instead of customizing an event that handles an event, you have to have AutoEventWireup="true".

Which the documentation says to avoid this if performance is an issue. So considering on all websites performance is likely an issue, it is better to use false and Handles, rather than overriding? Because use "true" automatically hits all events, needed or not, right?
Sachintana DissanayakeSenior Web DeveloperCommented:
Yes, overriding reduces the performance, that's a base concept.
Event handling will fires as an event, but in a override it has to find all the overrides when executing Page_Load internally.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.