Inserting a text box into the markup
Let's begin with Default.aspx
, as shown in the following screenshot, and then we will drag in a text box:

Figure 2.9.1: Our Default.aspx starting point for this chapter
To open the toolbox, go to View
|
Ctrl+Alt+XToolbox
()
. Then, type tex
into the Search
box, and drag TextBox
into the markup, as shown in the following screenshot:

Figure 2.9.2: TextBox is inserted into the markup
Remember, all that appears in Default.aspx
is called markup.
Entering your C# code
In the next stage, we'll switch to the Design
View, and see that there's a box and it's a label, as shown in the following screenshot:

Figure 2.9.3: In the Design view, you see the box here and the label
Double-click on the box and that brings up a stub, as shown in the following code block. This is where we put our C#:
protected void TextBox1_TextChanged(object sender, EventArgs e) { }
Now, if you go back to the Source
View for a second, it says OnTextChanged =
and then the name of the TextBox1_TextChanged...