Simple question to the group...

Discussion in 'ASP .Net' started by Blue Streak, Mar 12, 2009.

  1. Blue Streak

    Blue Streak Guest

    What is the difference between having code in an ASPX page like this:

    <script language="VB" runat="server">
    .... .NET code here...
    </script>

    vs.

    <%
    .... .NET code here...
    %>

    TIA...
     
    Blue Streak, Mar 12, 2009
    #1
    1. Advertising

  2. Blue Streak

    bruce barker Guest

    whether the code is defined in a method, or outside a method in the page
    source code. don't know vb but in c# its:

    class mypage
    {

    // runat server code goes here



    void createobjmodel()
    {
    // createParsedObjectsBefore
    // <% code %>
    // createParesedObjectsAfter
    // <% more code %>
    }
    }


    this usually means that <script runat=server> can only have methods,
    class variables and properties. <% %> can only have inline code (what is
    legal inside a method.


    -- bruce (sqlwork.com)



    Blue Streak wrote:
    > What is the difference between having code in an ASPX page like this:
    >
    > <script language="VB" runat="server">
    > ... .NET code here...
    > </script>
    >
    > vs.
    >
    > <%
    > ... .NET code here...
    > %>
    >
    > TIA...
     
    bruce barker, Mar 12, 2009
    #2
    1. Advertising

  3. Blue Streak wrote:
    > What is the difference between having code in an ASPX page like this:
    >
    > <script language="VB" runat="server">
    > ... .NET code here...
    > </script>
    >
    > vs.
    >
    > <%
    > ... .NET code here...
    > %>


    Think about how easy it is going to be to maintain the page, looking through
    all the code interspersed with html, and getting all the <% and %> matched.

    Then change to using code-behind rather than either of the above :)

    Andrew
     
    Andrew Morton, Mar 12, 2009
    #3
  4. Blue Streak

    Hillbilly Guest

    Until we take a look at the ASP.NET MVC architecture which takes us
    backwards in time to embed code in HTML all over again as we did in ASP.


    "Andrew Morton" <> wrote in message
    news:...
    > Blue Streak wrote:
    >> What is the difference between having code in an ASPX page like this:
    >>
    >> <script language="VB" runat="server">
    >> ... .NET code here...
    >> </script>
    >>
    >> vs.
    >>
    >> <%
    >> ... .NET code here...
    >> %>

    >
    > Think about how easy it is going to be to maintain the page, looking
    > through all the code interspersed with html, and getting all the <% and %>
    > matched.
    >
    > Then change to using code-behind rather than either of the above :)
    >
    > Andrew
    >
     
    Hillbilly, Mar 12, 2009
    #4
  5. MVC will not require any "code" on the page. What little markup you _will_
    have to write will drastically reduce the amount of ASPX markup you'll have.
    Turn the volume down on the FUD a little. ;)

    "Hillbilly" <> wrote in message
    news:...
    > Until we take a look at the ASP.NET MVC architecture which takes us
    > backwards in time to embed code in HTML all over again as we did in ASP.
    >
    >
    > "Andrew Morton" <> wrote in message
    > news:...
    >> Blue Streak wrote:
    >>> What is the difference between having code in an ASPX page like this:
    >>>
    >>> <script language="VB" runat="server">
    >>> ... .NET code here...
    >>> </script>
    >>>
    >>> vs.
    >>>
    >>> <%
    >>> ... .NET code here...
    >>> %>

    >>
    >> Think about how easy it is going to be to maintain the page, looking
    >> through all the code interspersed with html, and getting all the <% and
    >> %> matched.
    >>
    >> Then change to using code-behind rather than either of the above :)
    >>
    >> Andrew
    >>

    >
     
    Michael Earls, Mar 24, 2009
    #5
    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. Akaketwa
    Replies:
    1
    Views:
    5,072
    impaler
    Sep 22, 2006
  2. Replies:
    0
    Views:
    578
  3. christopher taylor
    Replies:
    0
    Views:
    442
    christopher taylor
    Sep 17, 2008
  4. cpld-fpga-asic
    Replies:
    13
    Views:
    1,223
    rickman
    Jul 6, 2009
  5. Dag Sunde
    Replies:
    0
    Views:
    141
    Dag Sunde
    Nov 18, 2005
Loading...

Share This Page