Skip to main content
CSharpUniversity ASP.NET and C# lessons

The search runs entirely in your browser over the published lesson list.

Meet the server controls that make a page react

A server control is a piece of markup the server understands as an object. That one idea is the foundation of every interactive page you will build.

Plain markup compared with a control

A plain input box sends its value and forgets about it. A server control is an object the server can read, change and react to. It looks similar in the browser and behaves very differently on the server.

Markup
<asp:TextBox id="nameBox" runat="server" />
<asp:Button id="sendButton" runat="server"
    Text="Send" OnClick="sendButton_Click" />

What the runtime attribute means

The runtime attribute tells the server to treat the element as an object. Give the control an identifier and you can refer to it by name in your C# code, exactly like any other object.

Controls are objects. Everything you learned about classes and properties now applies to the page. A text box has a Text property. A label has a Text property. Setting one is no different from setting a field.

Now put that idea to work in changing a control from your C# code.

New lessons by email

Leave your address and get a short note whenever a fresh lesson is published. No account needed and you can stop at any time.

Thank you. Your address has been noted in this browser session. Connect a mailing service to deliver the notes for real.