A.4. Chapter 4
A.4.1.
A.4.1.1.
A.4.1.1.1. Exercise 1 solution
The mechanism that enables controls to maintain their state is called ViewState.
A.4.1.1.2. Exercise 2 solution
The ASP.NET run time stores the values for the controls on a hidden field called __VIEWSTATE. This hidden field is sent with each postback to the server, where it's unpacked and then used to repopulate the controls in the page with their previous values.
A.4.1.1.3. Exercise 3 solution
The DropDownList only allows a user to make a single selection whereas the ListBox allows for multiple selections. In addition, the DropDownList only shows one item in the list when it's not expanded, while the ListBox is capable of displaying multiple items simultaneously.
A.4.1.1.4. Exercise 4 solution
In order to have a CheckBox control submit back to the server when you select or clear it in the browser, you need to set the AutoPostBack property to True:
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" />
A.4.1.1.5. Exercise 5 solution
Many of the ASP.NET Server Controls let you change colors using properties like BackColor and ForeColor. Additionally, you can use BorderColor, BorderStyle, and BorderWidth to change the border around a control in the browser. Finally, to affect the size of the control, you need to set its Height and Width properties.
A.4.1.1.6. Exercise 6 solution
Instead of setting individual style properties as listed in the previous exercise, you're much better off setting the ...
Get Beginning ASP.NET 3.5: In C# and VB now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.