Display TextBox when CheckBox is checked in ASP.Net using C#

  ASP.NET   Friday, January 11, 2019   769 | No Comments Yet!!! | No Download | No Demo | Pawan kumar
 Tags: Display TextBox when CheckBox is checked 


Introduction

Here Pawan Kumar will explain how to Display TextBox when CheckBox is checked in ASP.Net using C#

Description

In previous post I have explained Export HTML Table to PDF in ASP.Net with C# using iTextSharp DLL Library, Disabled submit button after clicked using jQuery with example, Simple HTML5 Example (Canvas) with Example Source Code, Create or Generate QR Code in ASP.Net using C#, ASP.NET : Source Code to ASP.NET : Source Code to Get GridView CheckBox Selected Rows jQuery, Check whether CheckBox is checked or not in ASP.Net using C#, and many more articles.

Now I will explain How to Display TextBox when CheckBox is checked in ASP.Net using C#

So follow the steps to learn Display TextBox when CheckBox is checked in ASP.Net using C#

CS.aspx

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

<!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 id="Head1" runat="server">
    <title>asp.net sourec code - Display TextBox when CheckBox is checked in ASP.Net using C# </title>
    <style type="text/css">
        body
        {
            font-family: Arial;
            font-size: 10pt;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:CheckBox ID="chkAadhaar" Text="Do you have kAadhaar?" runat="server" OnCheckedChanged="OnCheckChanged"
        AutoPostBack="true" />
    <hr />
    <asp:Panel ID="pnlAadhaar" runat="server" Visible="false">
        Aadhaar Number:
        <asp:TextBox ID = "txtAadhaar Number" runat="server" />
    </asp:Panel>
    </form>
</body>
</html>

CS.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class CS : System.Web.UI.Page
{
    protected void OnCheckChanged(object sender, EventArgs e)
    {
        pnlAadhaar.Visible = chkAadhaar.Checked;
    }
}

 

Conclusion:

So, In this tutorial we have learned, Display TextBox when CheckBox is checked in ASP.Net using C#


Post Comments

if you have some suggestion, question, request on Display TextBox when CheckBox is checked in ASP.Net using C#.

Please use the comment box to express your views.

 

Comments: