|
|
ASP.NET Tutorial 6: Outputting Data to the Webpage
by Matt on 2010/01/13 at 12:24 pm
The Toolbox panel can usually be found on the left-most side of the Visual Studio window (unless you’ve relocated it). If it’s not visible, you can bring it back by selecting “View” from the menu, then selecting “Toolbox” in the drop-down list. You can also press Ctrl+W+X on the keyboard to open it up.
You should already be familiar enough with X/HTML to know what an attribute is. If not, then here’s the short-hit:
An attribute is any additional information stored inside an element’s opening tag. An attribute does not necessarily need to have a value, but they almost always do. For instance if we had this code: <span id="iMembers">42</span> We can see that the span has an id attribute with a value of "iMembers". .NET has a useful feature called Master Pages. These are essentially template files that contain the basic HTML structure (header,footer,etc) for any number of pages on your website. This way, your aspx pages simply need to contain the body content only… and if you have the master page attached, the header, footer, and other styling in the Master Page simply falls into place around the content.
We’ll discuss Master Pages in a lot more detail in later tutorials. Prerequisites: ASP.NET Tutorial 5: Conditionals 2 ( switch constructs )
This article explains the three primary methods of outputting data onto a webpage from the code-behind class: Labels, Literals, and the Response.Write() method. This article is also useful for gaining a basic understanding of how .NET handles communication between elements on the ASPX webpage and the C# code-behind class. Our next article will introduce .NET’s basic form handling. In the mean time, I recommend you play around with Labels and Literals a bit to get used to the way that .NET handles communication between ASPX elements and C# code. |
No Comments