Where is Page_Unload event?

G

Guest

Hi there,
I'm using Web Developer Express 2005 in my ASP.NET learning.
I tried creating a simple aspx page using "code-behind" approach. I noticed
that protected void Page_Load event method appears automatically in
mypage.aspx.cs
Ok, so far so good, but now I need to code something when Page_Unload occurs
but I can't find a place to choose or select Page_Unload event.

I'm asking this because I created a mypage2.aspx using "single-file"
approach: layout and code in my single file mypage2.aspx and if I click on
the dropdown list above the code-editor area these are the items:
Server Objects & Events
Page
form1
Server Code
Client Objects & Events
document
form1
window
Client Script

then I choose Page and at the dropdown list on the right I choose Unload and
my script becomes in this:
<script runat="server">
protected void Page_Unload(object sender, EventArgs e)
{

}
</script>

this way I'm able to put code in Page_Unload event.

How can I do this using "code-behind" approach?
Do I have to hard code it by-hand?
If this is the case, which advantages bring me the "code-behind" approach if
I'm not able to "access" all events from Server controls?

Thanks a lot, I really appreciate it
Best Regards
 
C

Cowboy \(Gregory A. Beamer\)

You can wire a routine to the Unload event of hte Page class. In VB it is
Handles this.Load. In C#, you have to wire the delegate to the event.
 
G

Guest

Thanks a lot for your reply Gregory.
Ok, this means that there's no "graphical" way to add the delegate to
Page_Unload event?

I really want to start projects using "code-behind" approach.

Best Regards
 
G

Guest

So what's stopping you...?
Nothing, I'm just beginning to code using "code-behind" approach. It is just
that I wanted to clear a doubt I had about the "graphical" way to add
delegates using this approach.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top