Learning C# 2005: Get Started with C# 2.0 and .NET Programming (2nd Edition)
19.5. Server Controls
Web Forms offer two types of Server Controls. The first is server -side HTML controls . These are HTML controls that you tag with the attribute runat =Server . Although these work, we won't spend time on them in this chapter. Instead, we will focus on ASP.NET Server Controls [*] that Microsoft designed to augment and replace the standard HTML controls. Server Controls provide a more consistent object model and more consistently named attributes. For example, with traditional and server-side HTML controls, input is not handled consistently: [*] Some programmers also call these "ASP Controls" or "Web Controls." <input type="radio"> <input type="checkbox"> <input type="button"> <input type="text"> <textarea>
Figure 19-7. Switching between design and source tabs after adding a radio group
Each input type behaves differently and takes different attributes, and text is handled with different types of controls depending on whether you want a single line or multi-line input. The Server Controls try to use attributes consistently. The Server Controls that correspond to the preceding HTML Server Controls are as follows : <asp:RadioButton> <asp:CheckBox> <asp:Button> <asp:TextBox rows="1"> <asp:TextBox rows="5">
When you use the Server Controls, ASP.NET translates them into ordinary HTML before sending the page back to the browser. What is seen on the browser is always industry-standard HTML and will run on virtually any browser by any manufacturer. |