One of the best things about ASP.Net is the object-oriented aspect of it. If
it is used as it should be, it makes developing active web pages much
easier. It does require a learning curve to master, but if you design your
business classes well, and design your controls well, it actually requires
much less work to develop.
For example, my company recently needed a reporting tool for reporting on
the daily status of a service I wrote, which writes detailed information
about its transactions to a text log file. So, I began to develop a class
which parses the log file and puts all of the pieces into nice little
packages of text. It has a DailyReport class, which has a summary for the
day, and is a collection of JobReport classes. The JobReport class has a
summary for the Job, which runs every 10 minutes, and is a Collection of
FtpFile classes. The FtpFile class is a set of data about the details of how
an FTP file was created and uploaded to the National Weather Service.
Now, we have a Graphics/User Interface guy who isn't a heavy-duty
programmer, but a whiz with HTML, CSS, and so on. His job is to create the
web interface for our apps. So, I sat down and figured out the object model
for this DailyReport class, and the classes it contains. After that, I
stubbed out a set of classes with no code in them, just the object
structure, added Code Comments for Intellisense, and built it as a DLL. I
then gave the DLL to Dave (our Graphics guy), who added it to his ASP.Net
project in Visual Studio.
Now he's devloping the HTML and a User Control to host the report. He can
see what goes where in the page by looking at the object model for the
classes in the Visual Studio Object Browser. So, he first decides how the
page should look overall, using his HTML editor to build the page's outer
HTML, and some dummy text which will eventually be replaced by actual text
data. Note that he doesn't know or have to know anything about how the
classes work. He only has to know what properties contain what text.
Once he's done that (note that no programming is involved yet), He will
create an ASP.Net User Control, a templated control containing HTML and
other Server Controls, by pasting the HTML he developed for the report into
the Template. Then he will replace the dummy text with Label, Panel, and
other Server Controls, and where there are Collections, enclose the dummy
text in Repeater Controls.
Finally, he will wire up the Controls to their corresponding members in the
classes I'm developing (I'm filling in the code now), and a bit of Page code
to get the Airport ID and ReportDate from the QueryString, and Bob's your
uncle, it's done!
The Page Template itself will contain almost entirely HTML layout, with one
User Control reference in it. The User Control will contain almost entirely
HTML layout, with a few Server Control tags in it. And the CodeBehind will
contain a few lines of code that wire up the single class that I am building
(which contains 2 other classes as Collections) to the User Control, and a
bit of code that instantiates the User Control from the QueryString.
It doesn't get much simpler than that!
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.