Monday, February 1, 2010

First Website

As with every programming language, the first step is Hello World.

I come from a very heavy Object Oriented Background and have Experience with C++, so the switch to C# was not that startling to me.

I really enjoyed the Code behind the page setup, even if it is a bit bulky. Essentially every page has another page, that controls the functions and elements on that page. A little weird getting used to. I setup a page that had a label and a button, when the button is pressed, the page reloads and the label says something different.

How is this accomplished in .NET:

Add the Label:


This will create a Label Object in ASP, this is essentially a SPAN element when rendered out in HTML,

On the backend code, I can then modify this object however I please:


How this is Accomplished in PHP:



The next step after adding the Label, is to add the button, in PHP you must wrap it in a

element, while in ASP the entire page is already encased in a form element.
ASP:



You'll notice that it uses an onclick event, this is NOT the javascript onclick. THis tells ASP what to do, when the button is clicked (when the form is submitted).

This is controlled in the backend cs file, with the function

PHP:
We must wrap our button into a form element, easy to do


We then want it to change the $helloWorld variable to say something different, we can do this with a simple if then statement; So back where we set our $helloWorld variable we change it with:



And that is how I made my first webpage in ASP that actually did something.

Thoughts So Far?

.NET Blows. I hate it. I have to modify 2 files to get 1 result. It is nifty in that it is separated and easy to read, but the sheer time it takes to edit the functions and test and develop...is ....ugh....

No comments:

Post a Comment