65.9K
CodeProject is changing. Read more.
Home

Triple State Checkbox for Web

starIconstarIconstarIconemptyStarIconemptyStarIcon

3.00/5 (2 votes)

Mar 12, 2007

1 min read

viewsIcon

42870

downloadIcon

595

Triple State Checkbox for Web with Changeable CSS

Screenshot - TripleStateCheckbox.jpg

Introduction

In the case of inputting three states from the user, the checkbox fails. We can use Dropdown but it doesn't look so good. So, I thought of creating a triple-state-checkbox, just like Win Forms. This control uses the CSS to show three states of the checkbox. Currently, it returns 255 (byte's max value) for not selected, 0 - not selected and 1 for selected.

Background

This control is an extension of composite control which uses the Image and a Label control to

Using the code

Download the attached ZIP file which has a project named "YControls". Attach this project to your existing project or directly use the DLL from the BIN/debug folder of YControls project.

Web.Config

Registering the control to be available on all Forms. You can use any tagPrefix are per your stadards.

      <pages>
        <controls>
          <add namespace="YControls" assembly="YControls"  tagPrefix="YControls" />
        </controls>
      </pages>

Other Dependencies (CSS / Images)

Style.CSS and Images folder is currently bundled for the sample application. These are required. These can be changed as per requirement and themes can be applied.

Points of Interest

The application is not something which is differently coded, but the idea of trip-state-checkbox is new to web based forms, and found very useful in the cases of Yes/No/Default or anything which has something to do with triple-state.

History

This is the first version of triple-state-checkbox.