Better way to create a hyperLink in C#/.NET
Edit: This is in no way the best way to do this, by saying 'better' in my title I meant it as being better than entering it in manually because this lays the framework for it to become dynamic.
This is a continuation of the previous posting Easy Way to Create a HyperLink in C#/.NET.
The Code
This method of coding is known as the "code-behind model". This is because the code is separated into the HTML and the logic/backend code. Specifically the files would be Default.aspx (HTML) and Default.aspx.cs (logic). If you look at the code above you will see an attribute in the opening tag CodeBehind="Default.aspx.cs". This is where you reference any external file you would like to use with the page.
Code-Behind
From there, Visual Studio sets up a blank page for you to work from.
The file contains all the necessary classes to begin developing a web page. Along with that Visual Studio also gives you a base namespace/class to begin working with. The function Page_Load() seems to be the equivalent of __construct() in PHP. So when the class is initialized that function runs right away. If that is the case then we should be able to modify the HyperLink element inside of the Page_Load() function.
The Object HyperLink
HyperLink1.Text = "Hyperlink"; This is the ID name for the HyperLink element/object.
HyperLink1.Text = "Hyperlink"; This is a property of the HyperLink object. If you will remember along with Text there is also ImageUrl, NavigateUrl, Target, AccessKey, TabIndex, and many more properties of the HyperLink object.
HyperLink1.Text = "Hyperlink"; This is the value of the text to be displayed in the HyperLink.
This principle of object.property.value can be applied to any of the properties of the HyperLink object.
Afterthoughts
This method of declaring property values for an object does take some time to get used to. In the end it does set you up to build a more modular application though. Limiting the amount of code that actually formats an HTML element is the way to go.
Social Media