PC Review


Reply
Thread Tools Rate Thread

Delegate Creation

 
 
Scott M.
Guest
Posts: n/a
 
      16th Jan 2008
In a new VS 2005 ASP .NET Web Application Project (WAP), I'm looking at the
..designer.cs file to see how the event handlers for my page controls are
wired up to the events.

I was expecting to see the delegates being associated with the event
handling methods in the page (like in a Windows app), but instead found
nothing in either the .aspx.cs or the .aspx.designer.cs file that seems to
resemble anything having to do with wiring up events to the event handlers.

So, my question is: where is this code?


 
Reply With Quote
 
 
 
 
grava
Guest
Posts: n/a
 
      16th Jan 2008


"Scott M." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In a new VS 2005 ASP .NET Web Application Project (WAP), I'm looking at
> the .designer.cs file to see how the event handlers for my page controls
> are wired up to the events.
>
> I was expecting to see the delegates being associated with the event
> handling methods in the page (like in a Windows app), but instead found
> nothing in either the .aspx.cs or the .aspx.designer.cs file that seems to
> resemble anything having to do with wiring up events to the event
> handlers.
>
> So, my question is: where is this code?
>


No code for events if in yout aspx page you've got (default is true)
autoeventWireUp Attribute set to true.

So if you set this attribute to false you've got to override init event to
hook events to methods eg:

protected void Page_Load(object sender, EventArgs e)
{
...
}

override init(object sender, EventArgs e)
{
this.Load += new System.EventHandler(this.Page_Load);
}

HTH


--
Gianluca Gravina
http://blogs.ugidotnet.org/thinkingingrava

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      16th Jan 2008
I do see that the .aspx page directive of "AutoEventWireUp" is set to true.
I know that in VB .NET that means that the event is automatically wired up
to its event handler based on the name of the event handler being a
combination of the controlID an underscore and a valid event name.

Is this the same in C#? I guess so.


"Scott M." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In a new VS 2005 ASP .NET Web Application Project (WAP), I'm looking at
> the .designer.cs file to see how the event handlers for my page controls
> are wired up to the events.
>
> I was expecting to see the delegates being associated with the event
> handling methods in the page (like in a Windows app), but instead found
> nothing in either the .aspx.cs or the .aspx.designer.cs file that seems to
> resemble anything having to do with wiring up events to the event
> handlers.
>
> So, my question is: where is this code?
>



 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      16th Jan 2008
Ok, that's what I thought. Thanks!


"grava" <(E-Mail Removed)> wrote in message
news:AE5406F7-53F9-40EA-A8AD-(E-Mail Removed)...
>
>
> "Scott M." <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> In a new VS 2005 ASP .NET Web Application Project (WAP), I'm looking at
>> the .designer.cs file to see how the event handlers for my page controls
>> are wired up to the events.
>>
>> I was expecting to see the delegates being associated with the event
>> handling methods in the page (like in a Windows app), but instead found
>> nothing in either the .aspx.cs or the .aspx.designer.cs file that seems
>> to resemble anything having to do with wiring up events to the event
>> handlers.
>>
>> So, my question is: where is this code?
>>

>
> No code for events if in yout aspx page you've got (default is true)
> autoeventWireUp Attribute set to true.
>
> So if you set this attribute to false you've got to override init event to
> hook events to methods eg:
>
> protected void Page_Load(object sender, EventArgs e)
> {
> ...
> }
>
> override init(object sender, EventArgs e)
> {
> this.Load += new System.EventHandler(this.Page_Load);
> }
>
> HTH
>
>
> --
> Gianluca Gravina
> http://blogs.ugidotnet.org/thinkingingrava



 
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
Question of Style for Delegate creation Just_a_fan@home.net Microsoft VB .NET 3 14th Apr 2008 08:01 PM
Explicit vs implicit delegate creation? Peter Duniho Microsoft C# .NET 3 22nd Jun 2007 06:00 AM
delegate instance creation niceguybrijesh@yahoo.com Microsoft C# .NET 4 2nd Aug 2006 12:19 PM
Delegate issue - meetings only show up after delegate opened the request nils.pommerien@gmail.com Microsoft Outlook Calendar 0 21st Jul 2006 06:16 PM
coordinating the creation of delegate and event properties Darren Microsoft C# .NET 1 30th Aug 2004 07:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:05 AM.