HTML CONTROLS
HTML Controls are standard HTML elements such as input, button, textarea, select, etc.
When used with runat="server", they become HTML Server Controls and can be accessed in code-
behind using C#.
They support basic properties like Value, Checked, Disabled, and events like ServerChange or
ServerClick.
1️ BUTTON
Definition
Used to create an HTML button.
Syntax
<input type="button" id="btnOk" value="OK" runat="server" />
Important Properties
value → text on button
disabled → enable / disable button
Event
ServerClick (when clicked)
2️ RESET BUTTON
Definition
Resets all HTML form elements to default values.
Syntax
<input type="reset" id="btnReset" value="Reset" />
Properties
value
Event
❌ No server event
(Works automatically in browser)
3️ SUBMIT BUTTON
Definition
Submits form data to the server (POST).
Syntax
<input type="submit" id="btnSubmit" value="Submit" runat="server" />
Properties
value
Event
ServerClick
4️ TEXT FIELD (TextBox)
Definition
Gives user a single-line input area.
Syntax
<input type="text" id="txtName" runat="server" />
Properties
value
maxlength
size
Event
ServerChange
5️TEXT AREA
Definition
Used for multi-line text input.
Syntax
<textarea id="txtAddress" rows="4" cols="30" runat="server"></textarea>
Properties
rows
cols
value
Event
ServerChange
6️ FILE FIELD
Definition
Allows user to select a file from local machine.
Syntax
<input type="file" id="fileUpload" runat="server" />
Properties
PostedFile
Event
ServerChange
7️ PASSWORD FIELD
Definition
Input field where characters appear as *****.
Syntax
<input type="password" id="txtPwd" runat="server" />
Properties
value
maxlength
Event
ServerChange
8️ CHECKBOX
Definition
Allows user to select or clear an option.
Syntax
<input type="checkbox" id="chkAgree" runat="server" />
Properties
checked (true / false)
Event
ServerChange
9️ RADIO BUTTON
Definition
Used to select only one option from a group.
Syntax
<input type="radio" name="gender" value="Male" runat="server" /> Male
<input type="radio" name="gender" value="Female" runat="server" /> Female
Properties
checked
value
Event
ServerChange
🔟 TABLE
Definition
Displays data in tabular format.
Syntax
<table border="1" runat="server">
<tr><th>Name</th><th>Age</th></tr>
<tr><td>Sneha</td><td>21</td></tr>
</table>
Properties
rows
cells
Event
❌ No direct event
1️⃣1 IMAGE
Definition
Displays an image on the HTML page.
Syntax
<img src="[Link]" width="100" height="100" runat="server" />
Properties
src
width
height
alt
Event
❌ No event
1️⃣2️ LISTBOX
Definition
Displays a list of items; multiple items can be shown.
Syntax
<select size="4" runat="server">
<option>Apple</option>
<option>Mango</option>
</select>
Properties
size
selectedIndex
Event
ServerChange
1️⃣3 DROPDOWN
Definition
Displays one item at a time; user selects from list.
Syntax
<select runat="server">
<option>Chennai</option>
<option>Delhi</option>
</select>
Properties
selectedIndex
value
Event
ServerChange
1️⃣4️ HORIZONTAL RULE
Definition
Displays a horizontal line.
Syntax
<hr />
Properties
width
color
Event
❌ No event
What is CheckedChanged?
CheckedChanged is an event that occurs when the checked state of a CheckBox or RadioButton
control is changed by the user.
Step-by-step:
1. Student clicks Male
o Male becomes checked
o 👉 CheckedChanged event fires for Male
2. Student then clicks Female
o Male becomes unchecked
o Female becomes checked
o 👉 CheckedChanged event fires for Female
What is ServerChange?
ServerChange occurs when the VALUE of a control changes and is sent to the server.
🔹 Used with
TextBox (HTML input text)
TextArea
CheckBox
RadioButton
DropDown / ListBox
File upload
🔹 Why “Change”?
Because the content/value changes, not a click.
👉 Example:
Text changed
Checkbox checked / unchecked
RadioButton selection changed
Dropdown selection changed