tags:

views:

608

answers:

2

Hi,

I am trying to get the Page OnLoadComplete event auto wired up, but so far have been unsuccessful.

The name of it is "LoadComplete", so is it simply LoadComplete? Or does it follow the page_load syntax?

Nothing I have tried has worked so far. (I have a breakpoint in this event and it is never fired). I have tried variations of the signature below.

protected void LoadComplete(object sender, EventArgs e)

Thanks Kevin

+3  A: 

Did you set AutoEventWireup="true" in the Page directive (i.e. at the very top of your ASPX file)?

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

And it should follow the PageLoad syntax, i.e. Page_LoadComplete.

EDIT: You cannot auto wireup to the Page_LoadComplete method in a user control because that method is a Page method, not a Control method. If you need to use this event, you will need to attach it to the event at the init of your control and provide the event handler.

Check this link

Also check this thread for a reference to the list of Page events.

Matthew Jones
Yes. (This is a user control I'm working with)AutoEventWireup="true" is set in both the user control page directive as well as the page that calls it.
Kevin
+1  A: 

Kevin, it's Page_LoadComplete.