techniques needed --> moving from asp to asp.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jqpdev

    techniques needed --> moving from asp to asp.net

    Hello all,

    I've been developing web apps using Borland's websnap technology which is
    built upon asp technology.
    I'm tranisitioning to ASP.NET VS.NET and need some techniques/best practices
    to assist in the transition.

    I've created my apps/sites using a chunking method based on a template.
    Chunks of HTML and JScript are stored together in separate files, and groups
    of pages share a common template file. Most of the pages have their layout
    based on HTML tables (its just easier).

    I understand that the ASP.NET pages are based on a class (code behind), but
    how does one achieve consistency across a group of pages with respect to
    their HTML layout? Is a common template approach still a productive
    technique or will it be more of a headache in the long run? Should I be
    thinking in terms of generalizing groups of pages based on a base class, and
    then create child classes to address per-page specific needs?

    What are the criteria being used to separate what will go into a code behind
    class and what will be controlled by CSS?

    Last question (for now), Borland's tools allow one to quickly consume and
    transform an XML document to HTML, based on XSLT (and optionally CSS,
    JScript, Javascript). I'm curious to know if a lot of folks are using this
    method in ASP.NET. If so, what is the performance like, and how many
    hurdles does one have to jump through with this technique?

    I've been doing some reading and experimenting in my head, but I'm quickly
    compiling a large group of questions. Also, I'm writing my apps in C# with
    ..NET v1.1.


  • Eric Veltman

    #2
    Re: techniques needed --> moving from asp to asp.net

    Hello,

    jqpdev wrote:
    [color=blue]
    > I've created my apps/sites using a chunking method based on a template.
    > Chunks of HTML and JScript are stored together in separate files[/color]

    Those "chunks of ..." sound a lot like user controls. User controls are
    you're friend for making user interface components. The ascx file contains
    the html and webcontrols and the ascx.cs ( for C# ) or the ascx.vb ( for
    VB.NET ) codebehind contains the event handlers. They define what happens
    when the user control is initialized or when a user f.i. clicks a button.
    [color=blue]
    > I understand that the ASP.NET pages are based on a class (code behind)[/color]

    The code behind contains server side event handlers. The layout is mostly in
    the page main file ( .aspx ) or user control main file ( .ascx ). When
    an .aspx or .ascx is requested, the ASP.NET framework will auto-generate a
    class from the .aspx or .ascx file, which derives from the class in the
    code behind. This auto-generated class contains the code that's necessary
    to build the control tree according to the tags in the .aspx or .ascx.

    Because the auto-generated class is not present when you compile your
    project, you can not derive from it. As a result, derivation is not the way
    to get consistency in layout across a group of pages.
    [color=blue]
    > but how does one achieve consistency across a group of pages with respect
    > to their HTML layout? Is a common template approach still a productive
    > technique or will it be more of a headache in the long run?[/color]

    To get consistent look and feel, I used placeholders. In the main page I
    define all common layout and a placeholder. In the placeholder I
    dynamically load a user control, it depends on the query string which one I
    will load. If you want a deeper hierarchy of pages that are alike in look
    and feel, you can put everything that's common only for certain pages in a
    user control and put a placeholder in that user control.
    The URL may become something like :



    - index.aspx would contain layout common to all pages
    - news.ascx would be loaded into the placeholder in index.aspx
    and would contain all layout common to news items
    - sports.ascx would be loaded into the placeholder in news.ascx
    and would contain all layout common to sports news items.
    - tennis.ascx would be loaded into the placeholder in sports.ascx
    and would contain all layout common to tennis news items.

    Of course you have to write the code to dynamically load a control
    based on the querystring yourself, but that's easy.
    Look at LoadControl.
    [color=blue]
    > What are the criteria being used to separate what will go into a code
    > behind class and what will be controlled by CSS?[/color]

    The main aspx or ascx file should contain the layout.
    The code behind should contain as little layout and style as possible.
    The CSS should contain the style, e.g. colors, fonts, etc.
    [color=blue]
    > Last question (for now), Borland's tools allow one to quickly consume and
    > transform an XML document to HTML, based on XSLT (and optionally CSS,
    > JScript, Javascript). I'm curious to know if a lot of folks are using[/color]

    I'm not using XSL. I don't like it for this purpose. It's a transformation
    language, not a template language. I doubt if you can wysiwyg edit them
    very well.

    Best regards,

    Eric

    Comment

    • jqpdev

      #3
      Re: techniques needed --> moving from asp to asp.net

      Thanks Eric.

      Do you have a URL to a good article or tutorial on this?

      "Eric Veltman" <eric@[RemoveThis]veltman.nu> wrote in message
      news:vtmf99fqpb 4d24@corp.super news.com...[color=blue]
      > Hello,
      >
      > jqpdev wrote:
      >[color=green]
      > > I've created my apps/sites using a chunking method based on a template.
      > > Chunks of HTML and JScript are stored together in separate files[/color]
      >
      > Those "chunks of ..." sound a lot like user controls. User controls are
      > you're friend for making user interface components. The ascx file contains
      > the html and webcontrols and the ascx.cs ( for C# ) or the ascx.vb ( for
      > VB.NET ) codebehind contains the event handlers. They define what happens
      > when the user control is initialized or when a user f.i. clicks a button.
      >[color=green]
      > > I understand that the ASP.NET pages are based on a class (code behind)[/color]
      >
      > The code behind contains server side event handlers. The layout is mostly[/color]
      in[color=blue]
      > the page main file ( .aspx ) or user control main file ( .ascx ). When
      > an .aspx or .ascx is requested, the ASP.NET framework will auto-generate a
      > class from the .aspx or .ascx file, which derives from the class in the
      > code behind. This auto-generated class contains the code that's necessary
      > to build the control tree according to the tags in the .aspx or .ascx.
      >
      > Because the auto-generated class is not present when you compile your
      > project, you can not derive from it. As a result, derivation is not the[/color]
      way[color=blue]
      > to get consistency in layout across a group of pages.
      >[color=green]
      > > but how does one achieve consistency across a group of pages with[/color][/color]
      respect[color=blue][color=green]
      > > to their HTML layout? Is a common template approach still a productive
      > > technique or will it be more of a headache in the long run?[/color]
      >
      > To get consistent look and feel, I used placeholders. In the main page I
      > define all common layout and a placeholder. In the placeholder I
      > dynamically load a user control, it depends on the query string which one[/color]
      I[color=blue]
      > will load. If you want a deeper hierarchy of pages that are alike in look
      > and feel, you can put everything that's common only for certain pages in a
      > user control and put a placeholder in that user control.
      > The URL may become something like :
      >
      > http://somehost/index.aspx?module=ne...nis&article=28
      >
      > - index.aspx would contain layout common to all pages
      > - news.ascx would be loaded into the placeholder in index.aspx
      > and would contain all layout common to news items
      > - sports.ascx would be loaded into the placeholder in news.ascx
      > and would contain all layout common to sports news items.
      > - tennis.ascx would be loaded into the placeholder in sports.ascx
      > and would contain all layout common to tennis news items.
      >
      > Of course you have to write the code to dynamically load a control
      > based on the querystring yourself, but that's easy.
      > Look at LoadControl.
      >[color=green]
      > > What are the criteria being used to separate what will go into a code
      > > behind class and what will be controlled by CSS?[/color]
      >
      > The main aspx or ascx file should contain the layout.
      > The code behind should contain as little layout and style as possible.
      > The CSS should contain the style, e.g. colors, fonts, etc.
      >[color=green]
      > > Last question (for now), Borland's tools allow one to quickly consume[/color][/color]
      and[color=blue][color=green]
      > > transform an XML document to HTML, based on XSLT (and optionally CSS,
      > > JScript, Javascript). I'm curious to know if a lot of folks are using[/color]
      >
      > I'm not using XSL. I don't like it for this purpose. It's a transformation
      > language, not a template language. I doubt if you can wysiwyg edit them
      > very well.
      >
      > Best regards,
      >
      > Eric[/color]


      Comment

      • Eric Veltman

        #4
        Re: techniques needed --&gt; moving from asp to asp.net

        Hello,

        jqpdev wrote:
        [color=blue]
        > Do you have a URL to a good article or tutorial on this?[/color]

        I just read some stuff about a new feature in the next
        ASP.NET release, codenamed "Whidbey". The feature is
        called "Master Pages" and is another solution to achieve
        consistency in the UI. The next URL talks about it :

        Build web apps and services that run on Windows, Linux, and macOS using C#, HTML, CSS, and JavaScript. Get started for free on Windows, Linux, or macOS.


        Funny enough, when searching for information about it
        on google, I came across articles that were talking
        about using "Master Pages" with the released versions
        of ASP.NET. Seems like Microsoft ASP.NET team developed
        a solution for these versions, that works much like
        what will be available in Whidbey. Therefore, perhaps
        master pages are a better choice than what I first recommended.



        If you do want to use the same techniques I used,
        I have some links that may help.

        User controls :
        Tutorials on www.asp.net

        Dynamically loading user controls :


        Page templates :


        Best regards,

        Eric

        Comment

        Working...