does it still apply in 2.0

Discussion in 'ASP .Net' started by =?Utf-8?B?cm9kY2hhcg==?=, Feb 14, 2007.

  1. hey all,
    i was wondering if the following code snippet from a 1.1 exerpt still apply
    in asp.net 2.0 framework:

    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
    InitializeComponent();
    base.OnInit(e);
    }

    private void InitializeComponent()
    {
    BubbleControl.BubbleClick += new EventHandler(WebForm1_BubbleClick);
    }
    #endregion

    thanks,
    rodchar
     
    =?Utf-8?B?cm9kY2hhcg==?=, Feb 14, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?cm9kY2hhcg==?=

    Teemu Keiski Guest

    Yes it would work as-is, however VS2005 doesn't use it because in ASP.NET
    2.0 / VS2005 you can wire event handlers without touching the exact
    code-behind file (thanks to partial classes).

    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net



    "rodchar" <> wrote in message
    news:...
    > hey all,
    > i was wondering if the following code snippet from a 1.1 exerpt still
    > apply
    > in asp.net 2.0 framework:
    >
    > #region Web Form Designer generated code
    > override protected void OnInit(EventArgs e)
    > {
    > InitializeComponent();
    > base.OnInit(e);
    > }
    >
    > private void InitializeComponent()
    > {
    > BubbleControl.BubbleClick += new EventHandler(WebForm1_BubbleClick);
    > }
    > #endregion
    >
    > thanks,
    > rodchar
     
    Teemu Keiski, Feb 14, 2007
    #2
    1. Advertising

  3. so where could i put the contents of InitializeComponent() with regards to
    the partial class model?

    "Teemu Keiski" wrote:

    > Yes it would work as-is, however VS2005 doesn't use it because in ASP.NET
    > 2.0 / VS2005 you can wire event handlers without touching the exact
    > code-behind file (thanks to partial classes).
    >
    > --
    > Teemu Keiski
    > AspInsider, ASP.NET MVP
    > http://blogs.aspadvice.com/joteke
    > http://teemukeiski.net
    >
    >
    >
    > "rodchar" <> wrote in message
    > news:...
    > > hey all,
    > > i was wondering if the following code snippet from a 1.1 exerpt still
    > > apply
    > > in asp.net 2.0 framework:
    > >
    > > #region Web Form Designer generated code
    > > override protected void OnInit(EventArgs e)
    > > {
    > > InitializeComponent();
    > > base.OnInit(e);
    > > }
    > >
    > > private void InitializeComponent()
    > > {
    > > BubbleControl.BubbleClick += new EventHandler(WebForm1_BubbleClick);
    > > }
    > > #endregion
    > >
    > > thanks,
    > > rodchar

    >
     
    =?Utf-8?B?cm9kY2hhcg==?=, Feb 14, 2007
    #3
  4. =?Utf-8?B?cm9kY2hhcg==?=

    Teemu Keiski Guest

    Note that what I meant is that it's not used at all anymore. You can write
    it manually like that into code-behind if you like

    E.g With VS2005 you could to add it manually in case you intent to use it.
    The VS2005's ways are either just writing the handler in code or
    double-click the control in design view (or select the event from property
    browser and click it) to force it to generate the event handler. VS2005
    would generate them in C# as attributes to the controls. E.g if you have a
    Button on Page

    <asp:Button ID="Button1" runat="server" Text="Click me" />

    Double clicking the control on designer view would add
    OnClick="Button1_Click" to the Button's tag and add protected method to
    code-behind or inline code (depending on which model you use)


    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net




    "rodchar" <> wrote in message
    news:...
    > so where could i put the contents of InitializeComponent() with regards to
    > the partial class model?
    >
    > "Teemu Keiski" wrote:
    >
    >> Yes it would work as-is, however VS2005 doesn't use it because in ASP.NET
    >> 2.0 / VS2005 you can wire event handlers without touching the exact
    >> code-behind file (thanks to partial classes).
    >>
    >> --
    >> Teemu Keiski
    >> AspInsider, ASP.NET MVP
    >> http://blogs.aspadvice.com/joteke
    >> http://teemukeiski.net
    >>
    >>
    >>
    >> "rodchar" <> wrote in message
    >> news:...
    >> > hey all,
    >> > i was wondering if the following code snippet from a 1.1 exerpt still
    >> > apply
    >> > in asp.net 2.0 framework:
    >> >
    >> > #region Web Form Designer generated code
    >> > override protected void OnInit(EventArgs e)
    >> > {
    >> > InitializeComponent();
    >> > base.OnInit(e);
    >> > }
    >> >
    >> > private void InitializeComponent()
    >> > {
    >> > BubbleControl.BubbleClick += new EventHandler(WebForm1_BubbleClick);
    >> > }
    >> > #endregion
    >> >
    >> > thanks,
    >> > rodchar

    >>
     
    Teemu Keiski, Feb 14, 2007
    #4
  5. =?Utf-8?B?cm9kY2hhcg==?=

    bruce barker Guest

    OnInit

    -- bruce (sqlwork.com)

    rodchar wrote:
    > so where could i put the contents of InitializeComponent() with regards to
    > the partial class model?
    >
    > "Teemu Keiski" wrote:
    >
    >> Yes it would work as-is, however VS2005 doesn't use it because in ASP.NET
    >> 2.0 / VS2005 you can wire event handlers without touching the exact
    >> code-behind file (thanks to partial classes).
    >>
    >> --
    >> Teemu Keiski
    >> AspInsider, ASP.NET MVP
    >> http://blogs.aspadvice.com/joteke
    >> http://teemukeiski.net
    >>
    >>
    >>
    >> "rodchar" <> wrote in message
    >> news:...
    >>> hey all,
    >>> i was wondering if the following code snippet from a 1.1 exerpt still
    >>> apply
    >>> in asp.net 2.0 framework:
    >>>
    >>> #region Web Form Designer generated code
    >>> override protected void OnInit(EventArgs e)
    >>> {
    >>> InitializeComponent();
    >>> base.OnInit(e);
    >>> }
    >>>
    >>> private void InitializeComponent()
    >>> {
    >>> BubbleControl.BubbleClick += new EventHandler(WebForm1_BubbleClick);
    >>> }
    >>> #endregion
    >>>
    >>> thanks,
    >>> rodchar
     
    bruce barker, Feb 14, 2007
    #5
  6. Thanks everyone for the replies. I appreciate it. rod.


    "rodchar" wrote:

    > hey all,
    > i was wondering if the following code snippet from a 1.1 exerpt still apply
    > in asp.net 2.0 framework:
    >
    > #region Web Form Designer generated code
    > override protected void OnInit(EventArgs e)
    > {
    > InitializeComponent();
    > base.OnInit(e);
    > }
    >
    > private void InitializeComponent()
    > {
    > BubbleControl.BubbleClick += new EventHandler(WebForm1_BubbleClick);
    > }
    > #endregion
    >
    > thanks,
    > rodchar
     
    =?Utf-8?B?cm9kY2hhcg==?=, Feb 15, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dirk Meusel
    Replies:
    1
    Views:
    3,072
    Dirk Meusel
    Aug 19, 2003
  2. =?Utf-8?B?bXVzb3NkZXY=?=

    MSDNMag Article re Ngen - does it apply?!

    =?Utf-8?B?bXVzb3NkZXY=?=, Apr 18, 2006, in forum: ASP .Net
    Replies:
    7
    Views:
    1,813
    Steven Cheng[MSFT]
    Apr 24, 2006
  3. Stefan Siegl
    Replies:
    1
    Views:
    995
    Marrow
    Jul 18, 2003
  4. KJ
    Replies:
    7
    Views:
    611
    Andreas Kraftl
    May 29, 2005
  5. John Salerno
    Replies:
    28
    Views:
    849
    Terry Reedy
    Jan 27, 2008
Loading...

Share This Page