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 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

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

      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

        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
        #17

        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

          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
              • C Chris Maunder

                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 Offline
                R Offline
                Raj Lal
                wrote on last edited by
                #21

                Chris Maunder wrote:

                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.

                may be that could be a reason, Because most of the samples, extensively uses user/custom controls even for the master page layout etc so all they have in each of the page is a page with reference to a control. One more advantage i see using this approach is Recompilation When you use code behind, you have to recompile the whole application which is not easy when you have multiple developers working on different parts

                Omit Needless Words - Strunk, William, Jr.


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

                E C 2 Replies Last reply
                0
                • C Christian Graus

                  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 Offline
                  R Offline
                  Raj Lal
                  wrote on last edited by
                  #22

                  I do agree with you to an extent because i have been using it for last two years, But it does make me feel somewhat baffled why do they do that in all the samples if you download communityserver or starter kits all are totally inline code atleast there should be some reason for such stupidity (if it is one)

                  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

                    Chris Maunder wrote:

                    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.

                    may be that could be a reason, Because most of the samples, extensively uses user/custom controls even for the master page layout etc so all they have in each of the page is a page with reference to a control. One more advantage i see using this approach is Recompilation When you use code behind, you have to recompile the whole application which is not easy when you have multiple developers working on different parts

                    Omit Needless Words - Strunk, William, Jr.


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

                    E Offline
                    E Offline
                    Edbert P
                    wrote on last edited by
                    #23

                    Quartz... wrote:

                    When you use code behind, you have to recompile the whole application

                    Eh? Don't you have to recompile too when you change the code even using inline coding? The only time you don't need to recompile is if you change the HTML (excluding the ASP.Net controls), AFAIK.

                    "A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin Edbert Sydney, Australia

                    1 Reply Last reply
                    0
                    • R Raj Lal

                      Chris Maunder wrote:

                      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.

                      may be that could be a reason, Because most of the samples, extensively uses user/custom controls even for the master page layout etc so all they have in each of the page is a page with reference to a control. One more advantage i see using this approach is Recompilation When you use code behind, you have to recompile the whole application which is not easy when you have multiple developers working on different parts

                      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
                      #24

                      Quartz... wrote:

                      When you use code behind, you have to recompile the whole application which is not easy when you have multiple developers working on different parts

                      Not in 2.0.

                      cheers, Chris Maunder

                      CodeProject.com : C++ MVP

                      J 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
                        Raj Lal
                        wrote on last edited by
                        #25

                        Ok , i did find out the reason and i must say its revolutionary and ofcourse a refreshing approach and its not just laziness i know a lot of you might not agree but see this, you might rediscover the inline code ADVANTAGES OF INLINE CODE 1. Deploying single web pages to a server without recompiling the entire solution, That is the BEST ADVANTAGE of inline code YES IF YOU USE YOUR COMPLETE project as inline code this is possible 2. Making localized edits to single pages that take effect in real time. 3. A single file that contains both code and markup in one convenient self-contained package and it loads independently without a need of a web.dll We all know you have to compile the whole web.dll if you use the Code behind but , THIS is FAR more easy to Deploy and Maintain DISADVANTAGES OF INLINE CODE 1. Spaghetti code 2. Extremely limited intellisense 3. Crappy debugging There are definetly some great advantage too if it is done properly I think atleast these could be reason for all those online samples to be inline code

                        Omit Needless Words - Strunk, William, Jr.


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

                        A 1 Reply Last reply
                        0
                        • C Chris Maunder

                          Quartz... wrote:

                          When you use code behind, you have to recompile the whole application which is not easy when you have multiple developers working on different parts

                          Not in 2.0.

                          cheers, Chris Maunder

                          CodeProject.com : C++ MVP

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

                          Gee, there're folks still using 1.1?

                          "We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky

                          R J 2 Replies Last reply
                          0
                          • J Jerry Hammond

                            Gee, there're folks still using 1.1?

                            "We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky

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

                            Jerry Hammond wrote:

                            Gee, there're folks still using 1.1

                            That could be a whole new post, though yes i am still using .Net 1.1 and can't find a reason yet to convert to 2.0, With .Net 3.0 on the stack i think i will jump directly to 3.0 :) -- modified at 20:23 Monday 11th September, 2006

                            Omit Needless Words - Strunk, William, Jr.


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

                            M 1 Reply Last reply
                            0
                            • C Chris Maunder

                              Quartz... wrote:

                              When you use code behind, you have to recompile the whole application which is not easy when you have multiple developers working on different parts

                              Not in 2.0.

                              cheers, Chris Maunder

                              CodeProject.com : C++ MVP

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

                              Chris Maunder wrote:

                              Not in 2.0

                              Thats true With Page level pre-compile and Full runtime compilation, deployment has become a breeze in 2.0 but you will be surprised to know that The default in VS 2005 is "code behind" but can be changed to "inline coding" And VS 2005 not only supports single-file development with inline coding, but has also added/enhanced intellisense support for the inline code in single page development

                              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

                                S Offline
                                S Offline
                                Shog9 0
                                wrote on last edited by
                                #29

                                This evening or tomorrow, i'll probably be writing a small ASPX page with no codebehind, just to add an RSS feed for a DB table. It's... a page of code. Why bother opening two files?

                                ---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

                                1 Reply Last reply
                                0
                                • J Jerry Hammond

                                  Gee, there're folks still using 1.1?

                                  "We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky

                                  J Offline
                                  J Offline
                                  Jon Sagara
                                  wrote on last edited by
                                  #30

                                  Jerry Hammond wrote:

                                  Gee, there're folks still using 1.1?

                                  It seems the insurance industry is 2-4 years behind the times. If it works, why change it? They'll only switch when they find out they need a particular feature not offered by the current version.

                                  Jon Sagara When I grow up, I'm changing my name to Joe Kickass! My Site | My Blog | My Articles

                                  1 Reply Last reply
                                  0
                                  • C Chris Maunder

                                    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 Offline
                                    P Offline
                                    Polymorpher
                                    wrote on last edited by
                                    #31

                                    LOL

                                    Pablo Sometimes I think there's no reason to get out of bed . . . then I feel wet, and I realize there is.

                                    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
                                      Member 96
                                      wrote on last edited by
                                      #32

                                      Think about it, it's kinda obvious. --- edit: Ok, seems no one else pointed this out so maybe it's not so obvious, but it's a hell of a lot easier to post a working sample on a message board when it's inline.

                                      1 Reply Last reply
                                      0
                                      • R Raj Lal

                                        Jerry Hammond wrote:

                                        Gee, there're folks still using 1.1

                                        That could be a whole new post, though yes i am still using .Net 1.1 and can't find a reason yet to convert to 2.0, With .Net 3.0 on the stack i think i will jump directly to 3.0 :) -- modified at 20:23 Monday 11th September, 2006

                                        Omit Needless Words - Strunk, William, Jr.


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

                                        M Offline
                                        M Offline
                                        Mike Dimmick
                                        wrote on last edited by
                                        #33

                                        Yes, the idiotic naming decision raises its head again. ".NET 3.0" is .NET 2.0 plus what was going to be called WinFX. The CLR is still version 2.0. WinForms is still version 2.0. ASP.NET is still version 2.0. The new bits are Avalon Windows Presentation Foundation, Indigo Windows Communication Foundation and Windows Workflow Foundation. If you're only doing ASP.NET, there isn't even any point installing ".NET 3.0" runtime components.

                                        Stability. What an interesting concept. -- Chris Maunder

                                        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

                                          A Offline
                                          A Offline
                                          Ashley van Gerven
                                          wrote on last edited by
                                          #34

                                          Quartz... wrote:

                                          The whole .Net community

                                          For example? Which web apps are you talking about? I think since VS 2005 has intellisense in the aspx files it's bound to be more common.

                                          "For fifty bucks I'd put my face in their soup and blow." - George Costanza

                                          ~ Web SQL Utility - asp.net app to query Access, SQL server, MySQL. Stores history, favourites.

                                          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