Example code using 'System.Web.UI.HtmlControls.HtmlInputCheckBox'

Posted on 2010-09-01
Last Modified: 2013-12-17
Hi, I need your help on how to use the 'System.Web.UI.HtmlControls.HtmlInputCheckBox'  in codebehind.
Please provide me an example:
Question by:PagodNaUtak

Accepted Solution

enzogoy earned 500 total points
ID: 33583078
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33583665

Check code.


<<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server" method="post">
            <asp:Button ID="btnTest" runat="server" Text="Test" OnClick="btnTest_Click" />
            <input type="Checkbox" id="inChkBox" runat="server" value="yes" title="yes" /><asp:Label ID="lblResult" Text="yes" runat="Server"/>          

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e)
    protected void btnTest_Click(object sender, EventArgs e)
        HtmlInputCheckBox chk = (HtmlInputCheckBox)this.FindControl("inChkBox");

        if (chk.Value=="yes")
            lblResult.Text = "No";

Open in new window


Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question