Solved

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

Posted on 2010-09-01
2
631 Views
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:
0
Comment
Question by:PagodNaUtak
2 Comments
 
LVL 7

Accepted Solution

by:
enzogoy earned 500 total points
ID: 33583078
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33583665
Hi,

Check code.

Regards,
VSS

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server" method="post">
        <div>            
            <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"/>          
        </div>
    </form>
</body>
</html>

-----------------
//Default.aspx.cs
------------------
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

0

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 (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). 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