Modularised web code in asp.net / C#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I've just started learning web programming with ASP.net and C#, having been an "ordinary" ASP programmer for a few years.

I used to use the #include directive to attach files created which included functions, which I could call to display certain parts of a site (the menu, top bar, footer, etc) to make life easier.

My question is simply.. what's the best way to do a similar thing in ASP.net / C#? Should I still use #include? I've a feeling there's a better way these days! (BTW, these included functions frequently referenced the database).

Thanks for any help,

Cheers


Dan
 
Dan,

User Controls have replaced include files in ASP.NET

Also do some searches on google for ASP.NET base page. Using a base page
means creating a .aspx page that is then inherited by all pages on a site so
that common functionality is always included.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
Dan Nash said:
Hi

I've just started learning web programming with ASP.net and C#, having
been an "ordinary" ASP programmer for a few years.
I used to use the #include directive to attach files created which
included functions, which I could call to display certain parts of a site
(the menu, top bar, footer, etc) to make life easier.
My question is simply.. what's the best way to do a similar thing in
ASP.net / C#? Should I still use #include? I've a feeling there's a better
way these days! (BTW, these included functions frequently referenced the
database).
 
Big changes from ASP to ASP.NET. As mentioned, web user controls are the
way to go. If you want to make a templated type site, you might check out
my RJContentPanel control. It is free and helps to build multi page sites
quickly. I use it in most of my sites. For HintsAndTips though, I had to
add URL rewriting to make it more search engine friendly.

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!


Dan Nash said:
Hi

I've just started learning web programming with ASP.net and C#, having
been an "ordinary" ASP programmer for a few years.
I used to use the #include directive to attach files created which
included functions, which I could call to display certain parts of a site
(the menu, top bar, footer, etc) to make life easier.
My question is simply.. what's the best way to do a similar thing in
ASP.net / C#? Should I still use #include? I've a feeling there's a better
way these days! (BTW, these included functions frequently referenced the
database).
 
Okay, thanks guys. I've created my headers and footers using User Controls and all is working well.

But what about the "bits of code" that I have in ASP files that I used to use the include directive for? I'm talking about encryption routines, profantity filters etc, just little.. Sub...End Sub routines. I want to convert these all to C#.. there must be away of adding these to my projects at runtime so I can use these functions?

Cheers!


Dan
 
Dan said:
Okay, thanks guys. I've created my headers and footers using User
Controls and all is working well.

But what about the "bits of code" that I have in ASP files that I
used to use the include directive for? I'm talking about encryption
routines, profantity filters etc, just little.. Sub...End Sub
routines. I want to convert these all to C#.. there must be away of
adding these to my projects at runtime so I can use these functions?

Not at run time -- at compile time. Put this functionality in utility
classes and use these classes from you code behind classes.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top