using inline stmts vs Page_Load event

Discussion in 'ASP .Net' started by Jack Frost, Oct 31, 2003.

  1. Jack Frost

    Jack Frost Guest

    What is the consensus on putting ASP.NET code inline in the html doc versus
    using code behind and C#. I find it confusing when pages include code in
    both places. For example, using DataBinder.Eval statements in the HTML. Is
    there an advantage to doing any coding within the HTML page? It seems
    cleaner to do all coding in the webform but I am an admitted DOTNET newbie

    Thanks
    Jack Frost, Oct 31, 2003
    #1
    1. Advertising

  2. As long as it is not INSIDE the HTML (IOW, it is above the first <html>
    tag), it is fine to put your CodeBehind class definition in the same file as
    the Page Template. Mixing Code and Content is never a good idea.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Big Things are made up of
    Lots of Little Things.

    "Jack Frost" <> wrote in message
    news:3fa2dbab$...
    > What is the consensus on putting ASP.NET code inline in the html doc

    versus
    > using code behind and C#. I find it confusing when pages include code in
    > both places. For example, using DataBinder.Eval statements in the HTML.

    Is
    > there an advantage to doing any coding within the HTML page? It seems
    > cleaner to do all coding in the webform but I am an admitted DOTNET newbie
    >
    > Thanks
    >
    >
    Kevin Spencer, Oct 31, 2003
    #2
    1. Advertising

  3. Jack Frost

    Jack Frost Guest

    "Kevin Spencer" <> wrote in message
    news:%23tVRvx$...
    > As long as it is not INSIDE the HTML (IOW, it is above the first <html>
    > tag), it is fine to put your CodeBehind class definition in the same file

    as
    > the Page Template. Mixing Code and Content is never a good idea.
    >

    I agree but many of the MS code samples (IBuySpy for one) employ this
    technique. If I can't look to MS for guidance on best practices, where can
    I look? Do you have book recommendations?

    Thanks again.
    Jack Frost, Oct 31, 2003
    #3
  4. > I agree but many of the MS code samples (IBuySpy for one) employ this
    > technique.


    Not sure what "this technique" refers to.

    > If I can't look to MS for guidance on best practices, where can
    > I look? Do you have book recommendations?


    You certainly CAN look to MS for guidance on best practices. The .Net SDK,
    which is the only "book" I recommend, has a good number of articles on best
    practices. You can download the .Net SDK for free from the following URL:

    http://www.microsoft.com/downloads/...A6-3647-4070-9F41-A333C6B9181D&displaylang=en

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Big Things are made up of
    Lots of Little Things.

    "Jack Frost" <> wrote in message
    news:3fa2f082$...
    >
    > "Kevin Spencer" <> wrote in message
    > news:%23tVRvx$...
    > > As long as it is not INSIDE the HTML (IOW, it is above the first <html>
    > > tag), it is fine to put your CodeBehind class definition in the same

    file
    > as
    > > the Page Template. Mixing Code and Content is never a good idea.
    > >

    > I agree but many of the MS code samples (IBuySpy for one) employ this
    > technique. If I can't look to MS for guidance on best practices, where

    can
    > I look? Do you have book recommendations?
    >
    > Thanks again.
    >
    >
    Kevin Spencer, Nov 3, 2003
    #4
    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. Eric DELAGE
    Replies:
    2
    Views:
    678
  2. Eric DELAGE
    Replies:
    1
    Views:
    844
    Jonathan Bromley
    Apr 5, 2005
  3. Bob
    Replies:
    1
    Views:
    290
    Steve C. Orr, MCSD
    Jul 22, 2003
  4. rockdale
    Replies:
    1
    Views:
    655
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 16, 2006
  5. GGP
    Replies:
    2
    Views:
    460
    Paul Tomblin
    Mar 17, 2007
Loading...

Share This Page