Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-09-01
2
Medium Priority
?
644 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 2000 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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

916 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