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
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