Code in ASP or Class

  • Thread starter Thread starter Giovanni
  • Start date Start date
G

Giovanni

Hello,

I am new with ASP.net. I have a simple question.
Where would it be better to have the code for a function ?
in the Control within the ASP file; or in a class (ex. C# class) and then the
function called from the ASP file.

Thanks,

Giovanni
 
Put your code in a code-behind (class) and have your function called from
within it.
 
You can't write a function outside a class.

If you write scripting in "the ASP file" you are writing in the Page class,
or rather, the class that inherits your CodeBehind Class, which inherits the
System.Web.UI.Page class. It is extremely important to understand these
principles of OOP in order to be successful with ASP.Net.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 

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