ToolBox HTML Control HTMLCheckbox

HTML Checkbox Web Server Control

In ASP.NET environment,This article describes you how to work with HTML Checkbox Control.In HTML environment, Checkbox is an object that represents a Checkbox in an HTML form. The Checkbox control in a HTML form contains all instance of an <input type="checkbox"> tag.

The primary mechanism of the checkbox control is to perform toggle operaiton. In other words, Use the HtmlInputCheckBox control to allow the user to select a true or false state. To determine whether the control is selected, use the Checked property

There are several functions available to access the HTML checkbox.some of its funtions are as follows,

  • document.getElementById()
  • document.getElementByName()
checkbox Objects Properties
  • id -Sets or returns the id of a checkbox
  • form -Returns a reference to the form that contains the checkbox
  • accessKey -Sets or returns the keyboard key to access a checkbox
  • alt -Sets or returns an alternate text to display if a browser does not support checkboxs
  • disabled -Sets or returns whether or not a checkbox should be disabled
  • tabIndex -Sets or returns the tab order for a checkbox
  • name -Sets or returns the name of a checkbox
  • type -Returns the type of form element a checkbox is
  • checked -Sets or returns whether or not a checkbox should be checked
  • defaultchecked - Returns the default value of the checked attribute
  • value -Sets or returns the text that is displayed on the checkbox
  • title -Sets or returns an element's advisory title
  • lang -Sets or returns the language code for an element
  • dir -Sets or returns the direction of text
  • className -Sets or returns the class attribute of an element
checkbox Objects Methods
  • blur() -Performs focus when leave from the control
  • click() -Simulates a mouse-click on a checkbox
  • focus() -Performs focus when enter into the control

The following code snippets explains you the HTML checkbox in the web form.

in .aspx.cs page,

protected void SubmitBtn_Click(object sender, EventArgs e)
    {
      if (chkapple.Checked)
      {
        // set code
      }
      
      if (chkorange.Checked)
      {
        // set code
      }
      
      if (chkbanana.Checked)
      {
        // set code
      }
    
    }

        

in .aspx page,

<body>
       <form id="Form2" method=post runat=server>
         Enter Interests:  
         <input id="chkapple" checked type=checkbox runat=server> apple
         <input id="chkorange" type=checkbox runat=server> orange
         <input id="chkbanana" type=checkbox runat="server"> banana
                 
         <input id="Button1" type=button value="Enter" 
         OnServerClick="SubmitBtn_Click" runat=server>
        </form>
    </body>
 
Related Links

Posted by: Admin
Posted on: 9/18/2009 at 4:48 PM
Tags: , ,
Categories: Asp.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (5) | Post RSSRSS comment feed

Comments

Onlineatoz.net

Friday, September 18, 2009 4:50 PM

trackback

ToolBox HTML Control HTMLDiv

ToolBox HTML Control HTMLDiv

weight loss pills United States

Sunday, July 04, 2010 6:24 AM

weight loss pills

Despite the fact that slow and steady excess weight burning might be the solution to go for folks who are obese but not obese  the University of Florida research suggests that obese men and women will fare greater from the lengthy work if they drop fat easily in the starting of their software

christian louboutin black People's Republic of China

Monday, July 19, 2010 10:46 AM

christian louboutin black

earh gjhnj srth shy

nfl jersey People's Republic of China

Friday, July 23, 2010 9:11 AM

nfl jersey

Thanks for the info!!

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading