ASP.
NET Web Forms - HTML List Controls
This document explains HTML List Controls used in ASP.NET Web Forms with their
Properties, Events, and Examples.
1. HTML DropDownList (<select>)
Properties: Items, Value, SelectedIndex, InnerText, InnerHtml
Events: ServerChange
Example:
<select id="ddlCities" runat="server">
<option value="1">Chennai</option>
<option value="2">Mumbai</option>
<option value="3">Delhi</option>
</select>
2. HTML ListBox (<select multiple>)
Properties: Items, SelectedIndex, SelectedIndices, Size
Events: ServerChange
Example:
<select id="lstFruits" runat="server" multiple="multiple">
<option>Apple</option>
<option>Mango</option>
<option>Banana</option>
</select>
3. HTML CheckBox List (<input type='checkbox'>)
Properties: Checked, Value, Name
Events: ServerChange
Example:
<input type="checkbox" id="chkMath" runat="server" value="Math" /> Math
<input type="checkbox" id="chkScience" runat="server" value="Science" /> Science
<input type="checkbox" id="chkEnglish" runat="server" value="English" /> English
4. HTML RadioButton List (<input type='radio'>)
Properties: Checked, Value, Name
Events: ServerChange
Example:
<input type="radio" id="rbMale" name="gender" runat="server" value="Male" /> Male
<input type="radio" id="rbFemale" name="gender" runat="server" value="Female" />
Female
HTML Server Controls in .NET
HTML server controls in .NET are a set of controls that provide a way to create dynamic
web pages using HTML and server-side code. These controls are similar to standard HTML
controls but are enhanced with server-side functionality. Here are some key points about
HTML server controls in .NET:
Usage: HTML server controls are used to create interactive and dynamic web pages by
combining HTML and server-side code (C# or VB.NET).
Types: There are various types of HTML server controls such as TextBox, Button, CheckBox,
RadioButton, DropDownList, and many more. These controls provide server-side events
and properties that can be manipulated using server-side code.
Benefits: HTML server controls allow for easier management of web page elements and
their behavior. They also provide a way to handle user interactions and perform server-side
processing.
Event Handling: HTML server controls have server-side events such as Click,
SelectedIndexChanged, TextChanged, etc., which can be handled in the code-behind file to
perform specific actions.
ViewState: HTML server controls automatically maintain their state across postbacks using
ViewState, which makes it easier to retain user input and control values.
Example: Below is an example of a TextBox and a Button HTML server control in an
ASP.NET Web Form: