Sponsored Ad

Monday, May 3, 2010

How to Find Checkbox Status in C#

 

This sample code will help you to find checkbox status on check change.

 

How to Find Checkbox Status in C#

 

How to Find Checkbox Status in C#

 

Source code:

 

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    protected void chkTest_CheckedChanged(object sender, EventArgs e)
    {
        if (chkTest.Checked)
        {
            Response.Write("you have checked the checkbox");
        }
        else
        {
            Response.Write("you have unchecked the checkbox");
        }
    }
</script>

<html>
<head>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:CheckBox ID="chkTest" runat="server" AutoPostBack="true" OnCheckedChanged="chkTest_CheckedChanged"    />
        </div>
    </form>
</body>
</html>

No comments:

Post a Comment

Sponsored Ad

Development Updates