ASP.NET Basics / Source & Split View
Subtitles of the Movie
Now let's talk about one of the neat features that you get in the Visual Studio environment that you can use in ASP.NET and that's called the Split and Source View. Now keep in mind, this is not necessarily an ASP.NET function, but you do need to be aware of it and when I create my basic Web Form and I've clicked on the default on the aspx tab and I come down here and I'm Design View, usually by default. A lot of things can determine where you actually show up. Notice that what I'm really dealing with are three pages. I have my Default design page, which is my what-you-see-is-what-you-get version; it's going to roughly show me what it's going to look like in the browser; then I have my Code Behind page, where all of my Server-side code goes, but then, if I go back to Design and click Source, this is the actual HTML code that is generated for me that is actually stored on the server. If I scroll up and down through this you will notice there's a lot of things going on. First of all, there's a Page Directive up here, which we'll talk about later, that actually connects this code file right here, the Default.aspx, to the Default page. Then you can see some other stuff out here about HTML. You can see the. type and then you can see the actual HTML code. You will also notice that as I click on things here, on some of these, you're going to notice some of these tags changing down here and I can click on this and notice, if I clicked here it highlighted the body for me and if I click here it'll show me where my Form is, if I click here it'll show me that div tag and if I want to see my button I can click here and there's my button. Notice I can click a drop-down and I can select different tags if I have them out there. There's a lot of different things that you can do here just in this area. Now I'm going to click on this X and close this window so that you can see more here. Now that's the Source View. Now the thing that you need to understand is a lot of developers would rather work in this Source View than in this Design View and if I click on Design right here, it takes me right back to there. Understand this is the way it looks and on Source this is the code that generates that. Now if you're an old HTML buff then this makes sense to you. If you're not, let me just tell you, you need to know this stuff. This is very similar to what you experienced in Front Page, but this is not nearly as clunky as Front Page because one of these days you're going to have something out here on the Design Mode that's not giving you everything you need, not giving you exactly what you want and you want to get back into the Source and actually make it happen and this is how you would do it. Also, we'll talk about - a little bit later I'm going to show you a trick - some developers don't like working in that Code Behind page and this thing. And so they can actually embed that in the Source. I'll show you that trick later. Now, the next thing I want to show you is the Split Page and this is really cool because if I go into Split right here, I want you to notice - I'm going to pull this down a little bit - but if I want to see the code for this button I can click on it and notice it highlights it and there's the code for the button. If I want to see this label I can click on it and it shows me the code for the label. My drop-down, same thing. So, every aspect of this particular page, okay, notice I can still click on this stuff, alright and I can move around a lot of different ways here. Notice when I click up here it takes me to that location - notice that it's all inside my form and this will save you untold hours chasing things, chasing problems and troubleshooting down. So I just wanted you to see this and I know this can get confusing because there's a lot of pieces and parts here, so let me do a quick review here. We have Design View on our Default.aspx page and then we have Source View, which shows us the actual HTML code that makes that Design View work. Then we have Split, which will show us both at once and by clicking on one and either top or bottom, it will direct me to it in the other window. And again, this is a Visual Studio 2008 function that was enhanced in 2008. It works really, really cool for developing web pages. And then, of course, we have, I have my Code Behind page where my Server-side code is stored. So that's the Split and the Source View. Make sure those make sense because that Source is where you're going to go to really dig into this thing and make some magic happen from time to time.
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 