ASP.NET/C#: Magic Menu Web App: Part Three

Welcome to episode three of our series on the “Magic Menu” web app – the C# code!

Please check out part two before we begin if you like.

Default.aspx.cs

We start out by importing a standard set of namespaces, which generally hold tons of standard .NET classes we may want to use within the rest of our code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

Continue reading

ASP.NET/C#: Magic Menu Web App: A little aside…

Okay, let’s try a little analogy first before we get into the “Magic Menu” C# code to refresh our understanding of object-oriented programming!

A car is an object.

The car has a color – red, beige, purple – whatever you like. “color” is a property of our car object.

Say you don’t like the color anymore of that car, so you decide to get it painted. “Paint car” could be thought of as an action on the car, or a method. We might pass a parameter to “Paint car” that indicates to paint the whole car, maybe “all car”. That “Paint car” method will change the value of the “color” property (and paint our whole car).

Continue reading

ASP.NET/C#: Magic Menu Web App: Part Two

Part two of this series explores the starting page for the “Magic Menu” web app where we find the HTML code for our web form. It should be noted that this web app was built while studying the book “Beginning ASP.NET 4 in C# 2010” (MacDonald, Matthew. Beginning ASP.NET in C# 2010. USA: Apress, 2010) and uses similar concepts as a sample in the book, as well as some of its code bits and conventions.

Please check out part one before we get started if you like.

Default.aspx

We will begin with the opening information on the web form, which is quite similar to your standard HTML (XHTML 1.0) page.

Continue reading

ASP.NET/C#: Magic Menu Web App: Part One

This post started out simple enough and then became very, very, very long, so I decided to divide it up into a little series, sort of like a British television show. Hopefully I can keep it witty – or at least educational – and within the standard six episodes. On to episode one!

A while back I started working through the book “Beginning ASP.NET 4 in C# 2010” (MacDonald, Matthew. Beginning ASP.NET in C# 2010. USA: Apress, 2010). It is quite thorough — all 981 pages of it — but there is something exciting about becoming immersed in a massive new world with a confident writer as your guide. ASP.NET is a new world for me. It takes many of the tools I already have — HTML, Javascript, CSS, bits of database programming — and combines them in a structured, object-oriented environment full of web controls and exception handling.

Continue reading