ASP.NET Basics

HTML Basics
ASP.NET Web Server
Advanced HTML
Application Designing
Using Visual Studio
ASP.NET Standards
ASP.NET Styling
ASP.NET Navigation

ASP.NET Tips

ASP.NET Validation
HTML forms
CSS Styling
CSS Advanced
ASP.NET Features
ASP.NET Image Effects
Common mistakes
DB Design tips

Building Applications

Design Secure Apps
Build Secure Apps

6. HTML Checkboxes

« Previous Chapter

Next Chapter »

Check boxes are also inserted by using the standard <input> tag using both the Name and the Value attribute. Unlike the Radio buttons in HTML, the checkboxes in HTML can be in both states checked or unchecked, as they are not grouped. Due to this when using checkboxes you can have as many or only one checked as you or the user wants.

The following is an ASP.NET tutorial on how to add a HTML Checkbox into an ASP.NET page in Visual Studio.

  1. Go to the Toolbox and select the Input (Checkbox) from the HTML section.

HTML Input Checkbox
HTML Input Checkbox

  1. Drag and drop it onto the ASP.NET page’s form area.

  2. The following is the code snippet which is auto generated by Visual Studio in the Source View.

<input id="Checkbox1" type="checkbox" />

Note:

  • When a form using HTML checkbox is submitted, the browse will only send the textbox name and the value if it is selected, and will ignore if not.

You can also pre-select a checkbox by adding a “checked” attribute to the “<input>” tag.

<input type="checkbox" name="choiceVote" value="yes" checked>

Note:

  • Do not worry, the user will still have the ability to uncheck the checkbox, and check it again if needed, even if the preset for it “checked”.

« Previous Chapter

Next Chapter »

Table of Contents

Chapter 1 - Defining HTML Forms - <form> tag
        Chapter 1.1 - HTML Form Action attribute
        Chapter 1.2 - HTML Form Method attribute
        Chapter 1.3 - HTML Form Name attribute
Chapter 2 - HTML TextBox
        Chapter 2.1 - HTML Input Name attribute
        Chapter 2.2 - HTML Input Value attribute
Chapter 3 - HTML Buttons
        Chapter 3.1 - HTML Submit Button
        Chapter 3.2 - HTML Reset Button
Chapter 4 - HTML TextArea
Chapter 5 - HTML Radio Buttons
» Chapter 6 - HTML Checkboxes
Chapter 7 - HTML Selection Boxes
Chapter 8 - HTML Hidden Fields

[top]