ASP.NET Basics / Anatomy of a Web Form
Subtitles of the Movie
In the previous video we created a Web page and I named my Web site VTCExample and so what we're going to do now is let's talk about the anatomy of a Web Form. Now Microsoft calls this a Web Form. What it did for us is when we created our Web Project it opened the project up and it gave us a Default.aspx page and this is going to be the first page in our Web site and then we went and dropped a button on it and did some Code Behind. But I want you to notice what all's going on here. Notice we are in Design View - we'll talk about these others later - but right now we're in Design View and what we're looking at here is kind of a what-you-see-is-what-you-get kind of layout of our Web page, so you notice we have a Button and a Label here and if we go add anything else to this like a drop-down list, I can click here, I have to drag it on and there it is. Now, we'll talk about how this is laid out later, but this is exactly how it's going to look on the screen. The way Microsoft handles the code for this, the asp.net code, is they use what's called a Code Behind Page and there's a couple of ways to see it. First of all, if I double-click anywhere on the page it takes me back there and it automatically sets up an Event for what I just did, so I double-clicked on the page and notice it created this right here, which says on the Page Load, when the page loads, do something and what I can do here is say Label1.Text equal Page Loaded, then when we click the button it will change to You clicked. And so what I'm going to do is, notice, I went up here and clicked, I'm going to run the Web page and check it, I'm going to run without debugging. I could just hit Ctrl-F5 to do this and you'll notice that that Page Load event's going to fire and when the page first comes up it says Page Loaded, then when I click the Button it sends it to the Server, the code runs, it says You clicked and it sends it back to me. Notice my drop-down is here, but there's nothing in it. Again, the anatomy of this page is that I have the actual Default.aspx page and we'll look at the code on that later and then I have an aspx.VB, this is where my VB code is because I'm working in VB.NET. Now if I don't want this anymore I can just simply highlight it and delete it. Now I can also see these over here. Here's my Default.aspx page and if I double-click it here it will bring it up here and if I double-click the Default.aspx.VB it will put it here. Again, what's happening? When this gets sent to the Server later when we build this application and we load all this on the final Web server, all of this basically gets compiled together into one file, but we won't worry about that right now. But that's what Microsoft calls a Web Form. It is your original page with all of your HTML and stuff, which we have not looked at yet, but right now we're just seeing it in the design mode, and this is the way your page is going to look, generally, OK, in a browser - you'll have to play with it a little bit - and then the Code Behind page where all of your Server-side code is going to go, alright. So, that's a Web Form. Now in the next video we'll start to dig a little deeper into this.
Tutorial Information
| Course: | Microsoft ASP.NET 3.5 |
| Author: | Mark Long |
| SKU: | 34102 |
| ISBN: | 1-93633412-7 |
| Release Date: | 2010-03-24 |
| Duration: | 6 hrs / 69 lessons |
| Work Files: |
Yes |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 