By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,825 Members | 1,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,825 IT Pros & Developers. It's quick & easy.

using inline stmts vs Page_Load event

P: n/a
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
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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" <ex****@exc.dom> wrote in message
news:3f**********@newspeer2.tds.net...
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

Nov 17 '05 #2

P: n/a

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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.
Nov 17 '05 #3

P: n/a
> 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" <ex****@exc.dom> wrote in message
news:3f**********@newspeer2.tds.net...
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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.

Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.