Where to write the code

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Where to write the code

    Hello everyone,

    I just got done taking a small course in ASP.NET and I'm completely sold.
    This is amazing compared to original ASP.

    My question is about the preferred method of coding the asp pages. We were
    taught to write our code behind the page using VS.NET but some books I've
    seen have examples where you write the code right on the aspx page.

    Is one of these methods more proper than the other, maybe more preferred?

    Does anyone know of any pros and cons for each method?

    Thanks!

    - J


    Jay Guest

  2. Similar Questions and Discussions

    1. Write PHP code above HTML tag
      I've created a toolset that allows me to add Form fields that we use in our system. But now I want to take that a step further. I want to be able to...
    2. Write code
      Where I write the code? In a class file or in the component?
    3. how and where write code
      What is the best practices to write code in flash mx pro? That is where I write the code? In the scene, in a class ".as", or in the single...
    4. How to write to HeaderTemplate in the code
      How do you write into the HeaderTemplate of a datagrid the code (i.e the code behind file, the .vb file.) I see you can change the HeaderStyle...
    5. Program to write code
      Hi, could anyone recommend a good program to write code, currently using notepad. Thanks a lot in advance. Marcelo
  3. #2

    Default Re: Where to write the code

    One of the worst things about old ASP was that you had to mix presentation
    with logic. Messy Messy.
    Code behinds files are the solution. Enjoy it.
    Books tend to print examples the other way because it's easier to lay it out
    that way in a book rather than having 2 separate listings for a single page.
    VS.NET pretty much forces you to use code behinds way anyway.

    --
    I hope this helps,
    Steve C. Orr, MCSD
    [url]http://Steve.Orr.net[/url]


    "Jay" <jerry280@yahoo.com> wrote in message
    news:%23Yr58dyRDHA.1896@TK2MSFTNGP12.phx.gbl...
    > Hello everyone,
    >
    > I just got done taking a small course in ASP.NET and I'm completely sold.
    > This is amazing compared to original ASP.
    >
    > My question is about the preferred method of coding the asp pages. We were
    > taught to write our code behind the page using VS.NET but some books I've
    > seen have examples where you write the code right on the aspx page.
    >
    > Is one of these methods more proper than the other, maybe more preferred?
    >
    > Does anyone know of any pros and cons for each method?
    >
    > Thanks!
    >
    > - J
    >
    >

    Steve C. Orr, MCSD Guest

  4. #3

    Default Re: Where to write the code

    I'm with Steve on this one; use code behind as it is so much easier to
    maintain.

    --
    Carsten Thomsen
    Enterprise Development with Visual Studio .NET, UML, and MSF
    [url]http://www.apress.com/book/bookDisplay.html?bID=105[/url]
    "Jay" <jerry280@yahoo.com> wrote in message
    news:%23Yr58dyRDHA.1896@TK2MSFTNGP12.phx.gbl...
    > Hello everyone,
    >
    > I just got done taking a small course in ASP.NET and I'm completely sold.
    > This is amazing compared to original ASP.
    >
    > My question is about the preferred method of coding the asp pages. We were
    > taught to write our code behind the page using VS.NET but some books I've
    > seen have examples where you write the code right on the aspx page.
    >
    > Is one of these methods more proper than the other, maybe more preferred?
    >
    > Does anyone know of any pros and cons for each method?
    >
    > Thanks!
    >
    > - J
    >
    >

    CT Guest

  5. #4

    Default Re: Where to write the code

    I would say everything what goes to presentation layer goes into aspx.
    Business logic goes to DLL.
    Now the question is where Page::OnLoad belogs?

    I say it's a presentation layer and the best place for it in the aspx.


    George, MSCD ( I like my fancy title).

    "Steve C. Orr, MCSD" <Steve@Orr.net> wrote in message
    news:u9AP5gyRDHA.2008@TK2MSFTNGP11.phx.gbl...
    > One of the worst things about old ASP was that you had to mix presentation
    > with logic. Messy Messy.
    > Code behinds files are the solution. Enjoy it.
    > Books tend to print examples the other way because it's easier to lay it
    out
    > that way in a book rather than having 2 separate listings for a single
    page.
    > VS.NET pretty much forces you to use code behinds way anyway.
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD
    > [url]http://Steve.Orr.net[/url]
    >
    >
    > "Jay" <jerry280@yahoo.com> wrote in message
    > news:%23Yr58dyRDHA.1896@TK2MSFTNGP12.phx.gbl...
    > > Hello everyone,
    > >
    > > I just got done taking a small course in ASP.NET and I'm completely
    sold.
    > > This is amazing compared to original ASP.
    > >
    > > My question is about the preferred method of coding the asp pages. We
    were
    > > taught to write our code behind the page using VS.NET but some books
    I've
    > > seen have examples where you write the code right on the aspx page.
    > >
    > > Is one of these methods more proper than the other, maybe more
    preferred?
    > >
    > > Does anyone know of any pros and cons for each method?
    > >
    > > Thanks!
    > >
    > > - J
    > >
    > >
    >
    >

    George Ter-Saakov Guest

  6. #5

    Default Re: Where to write the code

    I would say everything code-wise is best in code-behind. You can still
    seperate your presentation and business logic very cleanly using
    code-behind, and the presentation code is much cleaner then it would in
    page.

    With code-behind it is also much simpler to write code (even presentation
    code) that is shared across many pages.

    Todd Thompson
    Todd Thompson Guest

  7. #6

    Default Re: Where to write the code

    NO question - BEHIND

    "Jay" <jerry280@yahoo.com> wrote in message
    news:#Yr58dyRDHA.1896@TK2MSFTNGP12.phx.gbl...
    > Hello everyone,
    >
    > I just got done taking a small course in ASP.NET and I'm completely sold.
    > This is amazing compared to original ASP.
    >
    > My question is about the preferred method of coding the asp pages. We were
    > taught to write our code behind the page using VS.NET but some books I've
    > seen have examples where you write the code right on the aspx page.
    >
    > Is one of these methods more proper than the other, maybe more preferred?
    >
    > Does anyone know of any pros and cons for each method?
    >
    > Thanks!
    >
    > - J
    >
    >

    David Waz... Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139