Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

How to add event to Web Form from the vs.net designer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James - 01 Mar 2008 20:48 GMT
Hi there,

I know that when i double click a web form I'm taking to the page_load
event.  However, I want to create an unload event by I don't know how to
create it from the vs.net designer.  Does anybody know how to create a page
unload event from the vs.net designer?

Many thanks
Jason Hedges - 02 Mar 2008 02:52 GMT
You can use the designer to configure events for the controls on a page
besides the default event you get by double-clicking the control by clicking
the events button on the Properties window for the control and then
double-clicking or typing in the field for the desired event. Unfortunately,
the Page itself does not have this option (see MSDN
http://msdn2.microsoft.com/en-us/library/6w2tb12s(VS.80).aspx).

So, you'll have to create it in code.

For C#, if you have AutoEventWireup="true" in your <%@ Page %> declaration
in the markup, you can put the following in your code to handle the Page
unload event:

protected void Page_UnLoad(object sender, EventArgs e)
{
    //Your page unload code here        
}

For VB, you can use the drop down box in the upper left corner of the code
window and select "(Page events)" and then select the event you want to
handle from the drop down box in the upper right corner (in this case the
unload event). Visual Studio will then create the procedure for you.

Hope that helps.
Jason


> Hi there,
>
[quoted text clipped - 5 lines]
> Many thanks
>  

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.