PC Review


Reply
Thread Tools Rate Thread

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

 
 
James
Guest
Posts: n/a
 
      1st Mar 2008
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



 
Reply With Quote
 
 
 
 
Jason Hedges
Guest
Posts: n/a
 
      2nd Mar 2008
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


"James" wrote:

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

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I create a custom control with a designer like a form designer trant Microsoft C# .NET 5 22nd Dec 2009 11:03 PM
Form designer error: "The designer could not be shown for this filebecause none of the classes within it can be designed" right after install Edgar Teufel Microsoft Dot NET Compact Framework 0 15th Jul 2005 05:08 PM
TextBox LostFoucs Event can not be been in Event Properties in designer Ming Ma Microsoft Dot NET Framework Forms 0 29th Mar 2004 07:05 AM
Re: How to Add OpenFileDialog event to my codes by Form Designer? Cor Microsoft VB .NET 1 26th Mar 2004 12:26 AM
base form's load event gets fired when form designer open. feng Microsoft VB .NET 3 10th Oct 2003 07:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:40 PM.