Still learning .NET...<script> tags??

  • Thread starter Thread starter D. Shane Fowlkes
  • Start date Start date
D

D. Shane Fowlkes

I'm a fairly skilled traditional ASP/VB programmer and am learning .NET. I
was (recently) surprised to read in a book about declaring and defining all
my page Functions in <script runat="server"></script> tags and these tags
"should" be after the <html> tag but before the <body> tag.

I'm used to writing all of my "logic" including functions, in block
delimiter tags such as <% %> above the <html> tag. So, is my method now
"old school" and should I write all of my logic in a <script> tag or is this
just another way of doing the same thing?

Right or wrong, I just prefer to write all of the logic in the very top of
the page before the HTML begins.....

--


*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************
 
I'm not 100% sure there is a right or wrong way to do your code but the
recommended approach is certainly the use of script tags over <%. The use
of <% %> is much more used now for code snippets only in page, or
databinding eval activities locally to bound controls for example - pretty
sure you cant even use them in the code behind model.

Where you put the script tags in a page probably wont make any difference
and the author may have been just promoting good practice.

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
 
Back
Top