Page Events
am 16.01.2008 18:55:36 von smarIn a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list of
the page (web form) events (i.e. new, init, loadviewstate, load,
saveviewstate, etc.) and set up event handlers for them?
In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list of
the page (web form) events (i.e. new, init, loadviewstate, load,
saveviewstate, etc.) and set up event handlers for them?
"Scott M."
news:uh14ciGWIHA.4904@TK2MSFTNGP06.phx.gbl...
> In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list
> of the page (web form) events (i.e. new, init, loadviewstate, load,
> saveviewstate, etc.) and set up event handlers for them?
In the code behind file, select "(FormName) Events" in the dropdown in the
top right, and all the form's events will be listed in the dropdown to the
right.
"Scott M."
news:uh14ciGWIHA.4904@TK2MSFTNGP06.phx.gbl...
> In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list
> of the page (web form) events (i.e. new, init, loadviewstate, load,
> saveviewstate, etc.) and set up event handlers for them?
Not quite sure what you mean about "seeing" the events...?
As for setting up event handlers for them, just start typing...
E.g. if you want a Page_Init event, just type the following into your
code-behind:
protected void Page_Init(object sender, System.EventArgs e)
{
}
and add some code...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
"Leon Mayne"
news:C5C87DEA-D009-4B68-A4C1-92163863709B@microsoft.com...
> "Scott M."
> news:uh14ciGWIHA.4904@TK2MSFTNGP06.phx.gbl...
>> In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list
>> of the page (web form) events (i.e. new, init, loadviewstate, load,
>> saveviewstate, etc.) and set up event handlers for them?
>
> In the code behind file, select "(FormName) Events" in the dropdown in the
> top right, and all the form's events will be listed in the dropdown to the
> right.
Looking at your other post, I see that you're using C#, not VB.NET. In that
case the above method won't work. Not sure in C#. You could look at the
object's events in the class viewer?
"Mark Rae [MVP]" wrote in message
news:eorf0oGWIHA.4696@TK2MSFTNGP05.phx.gbl...
> "Scott M."
> news:uh14ciGWIHA.4904@TK2MSFTNGP06.phx.gbl...
>
>> In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list
>> of the page (web form) events (i.e. new, init, loadviewstate, load,
>> saveviewstate, etc.) and set up event handlers for them?
>
> Not quite sure what you mean about "seeing" the events...?
>
> As for setting up event handlers for them, just start typing...
>
> E.g. if you want a Page_Init event, just type the following into your
> code-behind:
>
> protected void Page_Init(object sender, System.EventArgs e)
> {
>
> }
>
> and add some code...
I think the OP would like to see a list of events availble for an object,
e.g. if you didn't know that the Page_Init event existed then you'd have
trouble using it! In VB you can get a list of the object's events and when
you select one it will automatically create the handler for you. I can't see
similar functionality in C#. Do you know how to do this, as I'm also
interested!
>
> Looking at your other post, I see that you're using C#, not VB.NET. In
> that case the above method won't work. Not sure in C#. You could look at
> the object's events in the class viewer?
Just a question about this difference ... is there any reason there isn't an
"event explorer" in c# as we've got in vb.net ??
Thanks in advance.
--
Gianluca Gravina
http://blogs.ugidotnet.org/thinkingingrava
With your page open in the IDE, select "Page" from the leftmost dropdown
above the code...and then select the available events from the dropdown to its right.
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/
======================================
"Scott M."
> In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list of the page (web form) events (i.e. new,
> init, loadviewstate, load, saveviewstate, etc.) and set up event handlers for them?
>
>
> I think the OP would like to see a list of events availble for an object,
> e.g. if you didn't know that the Page_Init event existed then you'd have
> trouble using it! In VB you can get a list of the object's events and when
> you select one it will automatically create the handler for you. I can't
> see similar functionality in C#. Do you know how to do this, as I'm also
> interested!
Well, by default starting writing "this." and let the intellisense show up,
then you can search for events (you've got an icon that it's quite
self-explanatory). By default if you've got an event like "PreInit", with
autoEventWireUp you can write the code Page_PreInit, if the attribute is set
to false you have to override the method that will raise the event:
override OnPreInit()
{
base.OnPreInit();
// my code
}
--
Gianluca Gravina
http://blogs.ugidotnet.org/thinkingingrava
Yes, that's exactly the problem and what I'm after Leon!
"Leon Mayne"
news:98924AC8-81E7-4471-9435-6C4CF11F832B@microsoft.com...
> "Mark Rae [MVP]" wrote in message
> news:eorf0oGWIHA.4696@TK2MSFTNGP05.phx.gbl...
>> "Scott M."
>> news:uh14ciGWIHA.4904@TK2MSFTNGP06.phx.gbl...
>>
>>> In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a
>>> list of the page (web form) events (i.e. new, init, loadviewstate, load,
>>> saveviewstate, etc.) and set up event handlers for them?
>>
>> Not quite sure what you mean about "seeing" the events...?
>>
>> As for setting up event handlers for them, just start typing...
>>
>> E.g. if you want a Page_Init event, just type the following into your
>> code-behind:
>>
>> protected void Page_Init(object sender, System.EventArgs e)
>> {
>>
>> }
>>
>> and add some code...
>
> I think the OP would like to see a list of events availble for an object,
> e.g. if you didn't know that the Page_Init event existed then you'd have
> trouble using it! In VB you can get a list of the object's events and when
> you select one it will automatically create the handler for you. I can't
> see similar functionality in C#. Do you know how to do this, as I'm also
> interested!
If I type "this" in a page class, nothing happens. The only way I could do
that would be to go into an existing code block and type "this" to see the
intellisense dropdown. Then, I'd have to just know what is an event or an
overrideable event handler (which I can do). But, I was hoping for
something easier as in VB .NET, where you just select the top-left drop-down
in the code editor and then the top-right dropdown gives you the events for
the item in the left drop-down.
:(
"grava"
news:965486F5-E4D0-4F57-A7D6-CC5A1115B709@microsoft.com...
> >
>> I think the OP would like to see a list of events availble for an object,
>> e.g. if you didn't know that the Page_Init event existed then you'd have
>> trouble using it! In VB you can get a list of the object's events and
>> when you select one it will automatically create the handler for you. I
>> can't see similar functionality in C#. Do you know how to do this, as I'm
>> also interested!
>
> Well, by default starting writing "this." and let the intellisense show
> up, then you can search for events (you've got an icon that it's quite
> self-explanatory). By default if you've got an event like "PreInit", with
> autoEventWireUp you can write the code Page_PreInit, if the attribute is
> set to false you have to override the method that will raise the event:
>
> override OnPreInit()
> {
> base.OnPreInit();
> // my code
> }
>
>
> --
> Gianluca Gravina
> http://blogs.ugidotnet.org/thinkingingrava
>
>
>
Hi Scott,
Yes, for the C# asp.net designer, the page level events list does be an
existing limitation(as VB.NET IDE are developed separately from C# one). I
really suggest you to submit your comments on this to our product feedback
site:
http://connect.microsoft.com/feedback/default.aspx?SiteID=21 0
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Scott M."
>References:
<98924AC8-81E7-4471-9435-6C4CF11F832B@microsoft.com>
<965486F5-E4D0-4F57-A7D6-CC5A1115B709@microsoft.com>
>Subject: Re: Page Events
>Date: Wed, 16 Jan 2008 13:39:35 -0500
>
>If I type "this" in a page class, nothing happens. The only way I could
do
>that would be to go into an existing code block and type "this" to see the
>intellisense dropdown. Then, I'd have to just know what is an event or an
>overrideable event handler (which I can do). But, I was hoping for
>something easier as in VB .NET, where you just select the top-left
drop-down
>in the code editor and then the top-right dropdown gives you the events
for
>the item in the left drop-down.
>
>:(
>
>
>"grava"
>news:965486F5-E4D0-4F57-A7D6-CC5A1115B709@microsoft.com...
>> >
>>> I think the OP would like to see a list of events availble for an
object,
>>> e.g. if you didn't know that the Page_Init event existed then you'd
have
>>> trouble using it! In VB you can get a list of the object's events and
>>> when you select one it will automatically create the handler for you. I
>>> can't see similar functionality in C#. Do you know how to do this, as
I'm
>>> also interested!
>>
>> Well, by default starting writing "this." and let the intellisense show
>> up, then you can search for events (you've got an icon that it's quite
>> self-explanatory). By default if you've got an event like "PreInit",
with
>> autoEventWireUp you can write the code Page_PreInit, if the attribute is
>> set to false you have to override the method that will raise the event:
>>
>> override OnPreInit()
>> {
>> base.OnPreInit();
>> // my code
>> }
>>
>>
>> --
>> Gianluca Gravina
>> http://blogs.ugidotnet.org/thinkingingrava
>>
>>
>>
>
>
>
Thanks Steven, I'll do that.
"Steven Cheng[MSFT]"
news:MCa2tNLWIHA.4200@TK2MSFTNGHUB02.phx.gbl...
> Hi Scott,
>
> Yes, for the C# asp.net designer, the page level events list does be an
> existing limitation(as VB.NET IDE are developed separately from C# one). I
> really suggest you to submit your comments on this to our product feedback
> site:
>
> http://connect.microsoft.com/feedback/default.aspx?SiteID=21 0
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> --------------------
>>From: "Scott M."
>>References:
>
> <98924AC8-81E7-4471-9435-6C4CF11F832B@microsoft.com>
> <965486F5-E4D0-4F57-A7D6-CC5A1115B709@microsoft.com>
>>Subject: Re: Page Events
>>Date: Wed, 16 Jan 2008 13:39:35 -0500
>>
>>If I type "this" in a page class, nothing happens. The only way I could
> do
>>that would be to go into an existing code block and type "this" to see the
>>intellisense dropdown. Then, I'd have to just know what is an event or an
>>overrideable event handler (which I can do). But, I was hoping for
>>something easier as in VB .NET, where you just select the top-left
> drop-down
>>in the code editor and then the top-right dropdown gives you the events
> for
>>the item in the left drop-down.
>>
>>:(
>>
>>
>>"grava"
>>news:965486F5-E4D0-4F57-A7D6-CC5A1115B709@microsoft.com...
>>> >
>>>> I think the OP would like to see a list of events availble for an
> object,
>>>> e.g. if you didn't know that the Page_Init event existed then you'd
> have
>>>> trouble using it! In VB you can get a list of the object's events and
>>>> when you select one it will automatically create the handler for you. I
>>>> can't see similar functionality in C#. Do you know how to do this, as
> I'm
>>>> also interested!
>>>
>>> Well, by default starting writing "this." and let the intellisense show
>>> up, then you can search for events (you've got an icon that it's quite
>>> self-explanatory). By default if you've got an event like "PreInit",
> with
>>> autoEventWireUp you can write the code Page_PreInit, if the attribute is
>>> set to false you have to override the method that will raise the event:
>>>
>>> override OnPreInit()
>>> {
>>> base.OnPreInit();
>>> // my code
>>> }
>>>
>>>
>>> --
>>> Gianluca Gravina
>>> http://blogs.ugidotnet.org/thinkingingrava
>>>
>>>
>>>
>>
>>
>>
>
"Juan T. Llibre"
news:eDKbZuGWIHA.4808@TK2MSFTNGP05.phx.gbl...
> With your page open in the IDE, select "Page" from the leftmost dropdown
> above the code...and then select the available events from the dropdown to
> its right.
Sadly doesn't work in a C# ASP.NET project :-(
Scott: When you do add the enhancement request on connect, please post the
feedback Id on this thread so we can vote for it.
The Feedback ID is: 322994.
I've also posted this as a new thread in both the C# and the ASP .NET NG's
to hopefully attract more attention.
-Scott
"Leon Mayne"
news:E4D2F58C-C734-41B0-82CB-649392CB2BEC@microsoft.com...
> "Juan T. Llibre"
> news:eDKbZuGWIHA.4808@TK2MSFTNGP05.phx.gbl...
>> With your page open in the IDE, select "Page" from the leftmost dropdown
>> above the code...and then select the available events from the dropdown
>> to its right.
>
> Sadly doesn't work in a C# ASP.NET project :-(
>
> Scott: When you do add the enhancement request on connect, please post the
> feedback Id on this thread so we can vote for it.