473,809 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Where is Page_Unload event?

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(obj ect 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
Jun 1 '07 #1
5 15284
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.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

*************** *************** *************** ***
Think outside the box!
*************** *************** *************** ***
"Rolandpish " <Ro********@dis cussions.micros oft.comwrote in message
news:3C******** *************** ***********@mic rosoft.com...
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(obj ect 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

Jun 1 '07 #2
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
"Cowboy (Gregory A. Beamer)" wrote:
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.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

*************** *************** *************** ***
Think outside the box!
*************** *************** *************** ***
"Rolandpish " <Ro********@dis cussions.micros oft.comwrote in message
news:3C******** *************** ***********@mic rosoft.com...
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(obj ect 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


Jun 1 '07 #3
"Rolandpish " <Ro********@dis cussions.micros oft.comwrote in message
news:2F******** *************** ***********@mic rosoft.com...
I really want to start projects using "code-behind" approach.
So what's stopping you...?
--
http://www.markrae.net

Jun 2 '07 #4
I already replied to you in the spanish-language asp.net newsgroup,
but for the benefit of those who post here and not there, there's a code example at :

http://www.velocityreviews.com/forum...nd-module.html


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Rolandpish " <Ro********@dis cussions.micros oft.comwrote in message
news:2F******** *************** ***********@mic rosoft.com...
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
"Cowboy (Gregory A. Beamer)" wrote:
>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.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************** *************** *************** ****
Think outside the box!
************** *************** *************** ****
"Rolandpish " <Ro********@dis cussions.micros oft.comwrote in message
news:3C******* *************** ************@mi crosoft.com...
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(obj ect 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



Jun 2 '07 #5
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.
"Mark Rae" wrote:
"Rolandpish " <Ro********@dis cussions.micros oft.comwrote in message
news:2F******** *************** ***********@mic rosoft.com...
I really want to start projects using "code-behind" approach.

So what's stopping you...?
--
http://www.markrae.net

Jun 3 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
3495
by: Heidi Hundåla | last post by:
Hi ! I have a Wep App in C#. Page_Unload fires after Page_Load, and it seems totally unreasonable when you want to use this event when you _leave_ the page. In my project we wanted to use the Page_Unload - event to clean up the Session variables, but when it turns out that it fires before the end, it screws up the code, and
4
6097
by: Larry Morris | last post by:
The following code, pasted into a web form with a link button on it, will cause the page_unload event to fire twice. If I remove the response.redirect, the problem goes away :). I've got a work around, but I'm curious how one is supposed to programmatically navigate between web pages without the page_unload event firing twice. Thanks, Larry
3
3018
by: vvenk | last post by:
Hello: I was trying to destroy objects in the Page_Unload event. That's when I see that the Page_Unload event gets triggered when I load a page, right after it completes page_load event! Why? Venki
1
1151
by: dana lees | last post by:
Hello, How can i modify the Page_Unload event? Thanks, Dana
7
2117
by: Cenk | last post by:
Hi, After converting my projects to ASP.Net 2.0 I have seen a problem with Page_unload. Ä°n framework 1.1 page_unload event fires when you are leaving the page or has closed the browser window. Now in 2.0 when you initally load the page Page_unload event fires after page_load event. In some of our aspx pages we craete some versions of original records and if the user presses cancel button or just leaves the page without cancelling we...
0
1015
by: PeterKellner | last post by:
When I connect a simple sqldatasource to a simple gridview with DataSourceID, the SqlDataSource's select method is called in the PreRender event of the gridview. My question is how (and where) is that event getting registered? I've been looking through GridView source with Reflector and can't find it. Thanks Peter Kellner http://peterkellner.net
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7662
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.