Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Inline Code or Code behind

Inline Code or Code behind

Scheduled Pinned Locked Moved The Lounge
questionasp-netcsharpcomsysadmin
35 Posts 20 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Raj Lal
    wrote on last edited by
    #1

    Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

    Omit Needless Words - Strunk, William, Jr.


    Web based Project Management
    Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

    N C R C R 14 Replies Last reply
    0
    • R Raj Lal

      Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

      Omit Needless Words - Strunk, William, Jr.


      Web based Project Management
      Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      Horses for courses :-)

      Regards, Nish


      Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
      Currently working on C++/CLI in Action for Manning Publications. Also visit the Ultimate Toolbox blog (New)

      1 Reply Last reply
      0
      • R Raj Lal

        Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

        Omit Needless Words - Strunk, William, Jr.


        Web based Project Management
        Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

        C Offline
        C Offline
        Chris Losinger
        wrote on last edited by
        #3

        Quartz... wrote:

        What is the prime advantage of that ?

        i just assume they're lazy: it's easier to post one file than two. code behind is better. anyone who disagrees is wrong.

        image processing | blogging

        L R 2 Replies Last reply
        0
        • R Raj Lal

          Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

          Omit Needless Words - Strunk, William, Jr.


          Web based Project Management
          Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

          R Offline
          R Offline
          Rocky Moore
          wrote on last edited by
          #4

          I have heard that the performance is suppose to be the same nowadays (not so a while back). That said though, I see the use of code behind much cleaner than combining your pesentation and code in the same pages. Personally, I think it is just lazy programming to combine them.

          Rocky <>< Latest Code Blog Post: ASP.NET HttpException - Cannot use leading "..".. Latest Tech Blog Post: Microsoft Zune to be built by Toshiba

          1 Reply Last reply
          0
          • C Chris Losinger

            Quartz... wrote:

            What is the prime advantage of that ?

            i just assume they're lazy: it's easier to post one file than two. code behind is better. anyone who disagrees is wrong.

            image processing | blogging

            L Offline
            L Offline
            led mike
            wrote on last edited by
            #5

            Chris Losinger wrote:

            code behind is better. anyone who disagrees is wrong.

            Did you just bounce off the VB forum again? :-D

            1 Reply Last reply
            0
            • C Chris Losinger

              Quartz... wrote:

              What is the prime advantage of that ?

              i just assume they're lazy: it's easier to post one file than two. code behind is better. anyone who disagrees is wrong.

              image processing | blogging

              R Offline
              R Offline
              Raj Lal
              wrote on last edited by
              #6

              Chris Losinger wrote:

              code behind is better. anyone who disagrees is wrong.

              Well i think, that would be a gross generalization, If you do think like that, What do you think is advantage of using code behind rather than inline code other than number of files ? or if we do assume there is some "advantage behind" using inline code , What could that be ?

              Omit Needless Words - Strunk, William, Jr.


              Web based Project Management
              Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

              C C 2 Replies Last reply
              0
              • R Raj Lal

                Chris Losinger wrote:

                code behind is better. anyone who disagrees is wrong.

                Well i think, that would be a gross generalization, If you do think like that, What do you think is advantage of using code behind rather than inline code other than number of files ? or if we do assume there is some "advantage behind" using inline code , What could that be ?

                Omit Needless Words - Strunk, William, Jr.


                Web based Project Management
                Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                C Offline
                C Offline
                Chris Losinger
                wrote on last edited by
                #7

                Quartz... wrote:

                Well i think, that would be a gross generalization

                i would never make a gross generalization.

                Quartz... wrote:

                What do you think is advantage of using code behind rather than inline code other than number of files ?

                the increased separation of logic and presentation is nice.

                image processing | blogging

                1 Reply Last reply
                0
                • R Raj Lal

                  Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

                  Omit Needless Words - Strunk, William, Jr.


                  Web based Project Management
                  Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                  C Offline
                  C Offline
                  CCMint
                  wrote on last edited by
                  #8

                  The reason they use inline is because its easier to explain the tutorial. If they used code behind for an example they would have to explain what code behind is, why to use it, ect. for each example they use it in. Rather then going that route they simple use inline. Stick to the phrase KISS (keep it simple studpid) when it comes to tutorials. Their is no real performance difference is more of a preference, separating presentation from code.

                  1 Reply Last reply
                  0
                  • R Raj Lal

                    Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

                    Omit Needless Words - Strunk, William, Jr.


                    Web based Project Management
                    Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                    R Offline
                    R Offline
                    Rama Krishna Vavilala
                    wrote on last edited by
                    #9

                    My whole criteria is if there is very minimal code place it inline otherwise use code behind. If the code grows refactor it to convert into a code behind model.


                    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan

                    R 1 Reply Last reply
                    0
                    • R Raj Lal

                      Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

                      Omit Needless Words - Strunk, William, Jr.


                      Web based Project Management
                      Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                      M Offline
                      M Offline
                      Marc Clifton
                      wrote on last edited by
                      #10

                      From a declarative programming perspective, regardless of ASP.NET or not, I've decided I prefer code behind. The whole point is to keep a clean separation between the imperative and declarative code, and inline code, while a cute feature, I've found isn't useful. Marc

                      Thyme In The Country

                      People are just notoriously impossible. --DavidCrow
                      There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer
                      People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith

                      1 Reply Last reply
                      0
                      • R Raj Lal

                        Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

                        Omit Needless Words - Strunk, William, Jr.


                        Web based Project Management
                        Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                        J Offline
                        J Offline
                        Jerry Hammond
                        wrote on last edited by
                        #11

                        I like code behind. It is as simple as that. Here's your well or not-so-well documented code... ;P namespace Monster_Maker__alpha_ { partial class Form1 { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.lbHeader = new System.Windows.Forms.Label(); this.clbPartyNumber = new System.Windows.Forms.CheckedListBox(); this.cbPartyLevel = new System.Windows.Forms.ComboBox(); this.lbPartyNumber = new System.Windows.Forms.Label(); this.SuspendLayout(); // // lbHeader // this.lbHeader.Font = new System.Drawing.Font("Mistral", 26F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbHeader.Location = new System.Drawing.Point(310, 0); this.lbHeader.Name = "lbHeader"; this.lbHeader.Size = new System.Drawing.Size(300, 50); this.lbHeader.TabIndex = 0; this.lbHeader.Text = "Monster Maker (alpha)"; // // clbPartyNumber // this.clbPartyNumber.FormattingEnabled = true; this.clbPartyNumber.Items.AddRange(new object[] { "0", "1 to 3", "4 to 6", "7 to 9", "10+"}); this.clbPartyNumber.Location = new System.Drawing.Point(0, 46); this.clbPartyNumber.Name = "clbPartyNumber"; this.clbPartyNumber.Size = new System.Drawing.Size(120, 94); this.clbPartyNumber.TabIndex = 1; // // cbPartyLevel // this.cbPartyLevel.FormattingEnabled = true;

                        R 1 Reply Last reply
                        0
                        • R Rama Krishna Vavilala

                          My whole criteria is if there is very minimal code place it inline otherwise use code behind. If the code grows refactor it to convert into a code behind model.


                          Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan

                          R Offline
                          R Offline
                          Raj Lal
                          wrote on last edited by
                          #12

                          thats great But it seems to me that there is some unique advantage of using inline code for a much bigger web applications. The whole .Net community are doing that in each and every samples, There has to be something very simple and explainable. just a feeling i have since last week.

                          Omit Needless Words - Strunk, William, Jr.


                          Web based Project Management
                          Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                          J C A 3 Replies Last reply
                          0
                          • J Jerry Hammond

                            I like code behind. It is as simple as that. Here's your well or not-so-well documented code... ;P namespace Monster_Maker__alpha_ { partial class Form1 { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.lbHeader = new System.Windows.Forms.Label(); this.clbPartyNumber = new System.Windows.Forms.CheckedListBox(); this.cbPartyLevel = new System.Windows.Forms.ComboBox(); this.lbPartyNumber = new System.Windows.Forms.Label(); this.SuspendLayout(); // // lbHeader // this.lbHeader.Font = new System.Drawing.Font("Mistral", 26F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbHeader.Location = new System.Drawing.Point(310, 0); this.lbHeader.Name = "lbHeader"; this.lbHeader.Size = new System.Drawing.Size(300, 50); this.lbHeader.TabIndex = 0; this.lbHeader.Text = "Monster Maker (alpha)"; // // clbPartyNumber // this.clbPartyNumber.FormattingEnabled = true; this.clbPartyNumber.Items.AddRange(new object[] { "0", "1 to 3", "4 to 6", "7 to 9", "10+"}); this.clbPartyNumber.Location = new System.Drawing.Point(0, 46); this.clbPartyNumber.Name = "clbPartyNumber"; this.clbPartyNumber.Size = new System.Drawing.Size(120, 94); this.clbPartyNumber.TabIndex = 1; // // cbPartyLevel // this.cbPartyLevel.FormattingEnabled = true;

                            R Offline
                            R Offline
                            Raj Lal
                            wrote on last edited by
                            #13

                            well that could be one reason :laugh:

                            Omit Needless Words - Strunk, William, Jr.


                            Web based Project Management
                            Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                            1 Reply Last reply
                            0
                            • R Raj Lal

                              Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

                              Omit Needless Words - Strunk, William, Jr.


                              Web based Project Management
                              Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                              J Offline
                              J Offline
                              Joe Woodbury
                              wrote on last edited by
                              #14

                              Progammers debate the difference while web designers curse the programmers who do inline code. Separating interface and implementation is still a great idea no matter how much contempt .NET has for it. Examples use inline because it's easier to explain that way.

                              Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

                              1 Reply Last reply
                              0
                              • R Raj Lal

                                Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

                                Omit Needless Words - Strunk, William, Jr.


                                Web based Project Management
                                Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                                C Offline
                                C Offline
                                Chris Maunder
                                wrote on last edited by
                                #15

                                Inline code if either there is no UI (eg a pass-through page) ot the UI is something like "<%@ Page inherits=...%> (and nothing else), or the only code is a very small snippet that, say, overrides OnLoad and sets a value or two. My rule of thumb: only separate the code and design if there's code and design that needs separating.

                                cheers, Chris Maunder

                                CodeProject.com : C++ MVP

                                R 1 Reply Last reply
                                0
                                • R Raj Lal

                                  thats great But it seems to me that there is some unique advantage of using inline code for a much bigger web applications. The whole .Net community are doing that in each and every samples, There has to be something very simple and explainable. just a feeling i have since last week.

                                  Omit Needless Words - Strunk, William, Jr.


                                  Web based Project Management
                                  Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                                  J Offline
                                  J Offline
                                  Joe Woodbury
                                  wrote on last edited by
                                  #16

                                  In my experience the use of inline code is a combination of laziness, perceived performance improvement and power grabbing. It is easier and the more you use it, the more you force your view of the interface on the designers.

                                  Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

                                  1 Reply Last reply
                                  0
                                  • R Raj Lal

                                    thats great But it seems to me that there is some unique advantage of using inline code for a much bigger web applications. The whole .Net community are doing that in each and every samples, There has to be something very simple and explainable. just a feeling i have since last week.

                                    Omit Needless Words - Strunk, William, Jr.


                                    Web based Project Management
                                    Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                                    C Offline
                                    C Offline
                                    Chris Maunder
                                    wrote on last edited by
                                    #17

                                    Quartz... wrote:

                                    The whole .Net community are doing that in each and every samples

                                    Maybe they are being :baaaa!:? Use the tools as best it makes sense for your particular application, not because everyone else is cutting and pastingdoing it a particular way

                                    cheers, Chris Maunder

                                    CodeProject.com : C++ MVP

                                    P 1 Reply Last reply
                                    0
                                    • R Raj Lal

                                      Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

                                      Omit Needless Words - Strunk, William, Jr.


                                      Web based Project Management
                                      Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                                      C Offline
                                      C Offline
                                      Christian Graus
                                      wrote on last edited by
                                      #18

                                      Inline code is an abomination. Code behind is a major reason that ASP.NET is more readable and maintainable than 'classic' ASP.

                                      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                                      R 1 Reply Last reply
                                      0
                                      • R Raj Lal

                                        Chris Losinger wrote:

                                        code behind is better. anyone who disagrees is wrong.

                                        Well i think, that would be a gross generalization, If you do think like that, What do you think is advantage of using code behind rather than inline code other than number of files ? or if we do assume there is some "advantage behind" using inline code , What could that be ?

                                        Omit Needless Words - Strunk, William, Jr.


                                        Web based Project Management
                                        Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                                        C Offline
                                        C Offline
                                        Christian Graus
                                        wrote on last edited by
                                        #19

                                        Quartz... wrote:

                                        Well i think, that would be a gross generalization,

                                        Yep, but it's also true.

                                        Quartz... wrote:

                                        What do you think is advantage of using code behind rather than inline code other than number of files ?

                                        How is having more files an advantage ? Seperating HTML from code is essential to being able to do any sort of layout and being able to maintain code.

                                        Quartz... wrote:

                                        or if we do assume there is some "advantage behind" using inline code , What could that be ?

                                        Less confusing for people who don't get OO, perhaps ?

                                        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                                        1 Reply Last reply
                                        0
                                        • R Raj Lal

                                          Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke

                                          Omit Needless Words - Strunk, William, Jr.


                                          Web based Project Management
                                          Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes

                                          N Offline
                                          N Offline
                                          nicko
                                          wrote on last edited by
                                          #20

                                          when i'm using VS i use code-behinds - its cleaner and my source doesn't get published when i'm using Dreamweaver (yeah, i have to sometimes :)) i use inline - i hate using the commandline complier and inline doesn't have to be compiled. as someone else said above - horses for courses nicko

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups