Welcome to this new series reviewing the Pluralsight course One ASP.NET From Scratch by Jesse Liberty and Jeff Fritz.
Jesse Liberty is with three decades of experience writing and delivering software projects.
He is the author of 2 dozen books, and has been a Senior Technical Evangelist for Microsoft and a Distinguished Software Engineer for AT&T.
He is a Xamarin Certified Mobile Developer and MVP, Microsoft MVP and Telerik MVP.
Jesse also the host of “Yet Another Podcast”, which is a great show.
Jeff Fritz is a Program Manager for Microsoft in the ASP.NET and Azure Developer Experience teams.
Currently, he leads the NuGet team and manages the MSDN Web Developer Tools blog.
Prior to joining Microsoft, he was a Microsoft MVP, ASPInsider, INETA Community Champion and Developer Advocate for Telerik.
One ASP.NET From Scratch
This is the first course in the learning path Web Application Development With ASP.NET MVC5. It’s a beginner friendly course explaining the principle elements of ASP.NET.
Jesse presents the first five modules, and Jeff presents the final three.
Jesse introduces this course and starts with a very brief history covering Classic ASP and the major versions of ASP.NET and ASP.NET MVC.
The five components that are built on top of ASP.NET and are covered in this course are:
- Web Forms
- Model View Controller (MVC)
- Web Pages
- Web API
The first three of these are for creating websites, and the last two are for creating web services.
All that is needed to follow this course is some knowledge of C#. However there are a few different languages and technologies that are also good to know:
Web Forms offers two technologies HTML Controls and Web Controls
Arguably the easiest transition for beginners moving on from basic HTML pages.
HTML Controls supports only two events:
These provide a more consistent object interface, with richer controls composed of multiple HTML controls.
Jesse demonstrates how to create and ASP.NET in Visual Studio 2013, and shows us how the project options differ from Visual Studio 2012.
Jesse chooses Web -> ASP.NET Web Application and describes the many template options available:
- Web Forms
- Web API
Jesse chooses Empty and adds the Web Forms folders.
It is easy to drag and drop controls into the design view and then make modifications in the markup view. This demo covers the HTML Controls.
We begin with a textbox to enter our birthdate, and a submit button, and see that the markup runat=”server” makes it a server side control.
We also see the code behind file Default.aspx.cs where we write code for a message telling us our age.
Jesse runs up the application showing us it correctly calculates our age in years from our birth date, and more importantly shows us the source HTML markup.
We see that a script block with the function __doPostback has been created automatically for us.
Next we see a Web Controls demo. We see that in the markup each of these controls has the prefix asp: and runat=”server”
We see how to create a button click event handler for a button, and that this updates the marup with OnClick=”Submit_Click”
When we run the application again and view the source we see the following replacements have been made:
- Label replaced with a span element
- TextBox replaced with an input element
This is because what is sent to the browser is standard HTML, not ASP.NET.
Posting data, page navigation
A two part demonstration.
In Part 1 Jesse writes a ComputerOrder class, and our markup is in ComputerOrderForm.aspx.
ComputerOrderForm.aspx contains labels, text boxes and a DateTime object.
Jesse shows us the different formatting schemes for the DateTime control, then we add 2 radio buttons, one of which is checked, and a submit button.
The second page is ReviewComputerOrder.aspx.
Jesse explains the cross page posting is entirely legal but is generally a poor design decision. We should prefer posting back to the same page.
The Submit_Click function sets all of the ComputerOrder properties and save to Session State:
Session["CurrentOrder"] = order
In Part 2 we use this Session State in the page_load method of ReviewComputerOrder.aspx.cs
ComputerOrder order = Session["CurrentOrder"] as ComputerOrder
We can then use the various order properties to set controls on the new page.
Continue to Part 2 Advanced Web Forms