Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > using inline stmts vs Page_Load event

Reply
Thread Tools

using inline stmts vs Page_Load event

 
 
Jack Frost
Guest
Posts: n/a
 
      10-31-2003
What is the consensus on putting ASP.NET code inline in the html doc versus
using code behind and C#. I find it confusing when pages include code in
both places. For example, using DataBinder.Eval statements in the HTML. Is
there an advantage to doing any coding within the HTML page? It seems
cleaner to do all coding in the webform but I am an admitted DOTNET newbie

Thanks


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      10-31-2003
As long as it is not INSIDE the HTML (IOW, it is above the first <html>
tag), it is fine to put your CodeBehind class definition in the same file as
the Page Template. Mixing Code and Content is never a good idea.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Jack Frost" <(E-Mail Removed)> wrote in message
news:3fa2dbab$(E-Mail Removed)...
> What is the consensus on putting ASP.NET code inline in the html doc

versus
> using code behind and C#. I find it confusing when pages include code in
> both places. For example, using DataBinder.Eval statements in the HTML.

Is
> there an advantage to doing any coding within the HTML page? It seems
> cleaner to do all coding in the webform but I am an admitted DOTNET newbie
>
> Thanks
>
>



 
Reply With Quote
 
 
 
 
Jack Frost
Guest
Posts: n/a
 
      10-31-2003

"Kevin Spencer" <(E-Mail Removed)> wrote in message
news:%23tVRvx$(E-Mail Removed)...
> As long as it is not INSIDE the HTML (IOW, it is above the first <html>
> tag), it is fine to put your CodeBehind class definition in the same file

as
> the Page Template. Mixing Code and Content is never a good idea.
>

I agree but many of the MS code samples (IBuySpy for one) employ this
technique. If I can't look to MS for guidance on best practices, where can
I look? Do you have book recommendations?

Thanks again.


 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      11-03-2003
> I agree but many of the MS code samples (IBuySpy for one) employ this
> technique.


Not sure what "this technique" refers to.

> If I can't look to MS for guidance on best practices, where can
> I look? Do you have book recommendations?


You certainly CAN look to MS for guidance on best practices. The .Net SDK,
which is the only "book" I recommend, has a good number of articles on best
practices. You can download the .Net SDK for free from the following URL:

http://www.microsoft.com/downloads/d...displaylang=en

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Jack Frost" <(E-Mail Removed)> wrote in message
news:3fa2f082$(E-Mail Removed)...
>
> "Kevin Spencer" <(E-Mail Removed)> wrote in message
> news:%23tVRvx$(E-Mail Removed)...
> > As long as it is not INSIDE the HTML (IOW, it is above the first <html>
> > tag), it is fine to put your CodeBehind class definition in the same

file
> as
> > the Page Template. Mixing Code and Content is never a good idea.
> >

> I agree but many of the MS code samples (IBuySpy for one) employ this
> technique. If I can't look to MS for guidance on best practices, where

can
> I look? Do you have book recommendations?
>
> Thanks again.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Two of three SQL stmts execute: third results in table does not exist exception GGP Java 2 03-17-2007 02:39 AM
Materpage page_load event fired after content page_load? rockdale ASP .Net 1 11-16-2006 06:59 PM
PSL stmts in VHDL: how to describe asynchronous dependencies? Eric DELAGE VHDL 2 04-06-2005 05:15 AM
PSL stmts embedded in VHDL: how to do functional coverage w/it? Eric DELAGE VHDL 1 04-05-2005 04:29 PM
Newbie question about old include stmts Bob ASP .Net 1 07-22-2003 05:30 PM



Advertisments