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

  • Thread starter Thread starter jqpdev
  • Start date Start date
J

jqpdev

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.
 
Hello,
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

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.
I understand that the ASP.NET pages are based on a class (code behind)

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

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 :

http://somehost/index.aspx?module=news/sports/tennis&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.
What are the criteria being used to separate what will go into a code
behind class and what will be controlled by CSS?

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

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
 
Hello,
Do you have a URL to a good article or tutorial on this?

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 :

http://www.asp.net/whidbey

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.

http://authors.aspalliance.com/PaulWilson/Articles/?id=13

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 :
http://tinyurl.com/wrco

Page templates :
http://www.smartisans.com/articles/vb_templates.aspx

Best regards,

Eric
 
Back
Top