Tuesday, 7 July 2015

CheckBox Click TextBox Values Paste To Another TextBox Using Asp.Net C#

No comments    
categories: , , ,
CheckBox Click TextBox Values Paste To Another TextBox

If Enter Some Values in TextBox that Same Values Display Another Textbox Click CheckBox Paste Same Values To Another TextBox Using Asp.Net C#.

                 Download Coding
                              Download

                       DEMO


            
               HTML CODING

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>CheckBox Click TextBox Values Paste To Another TextBox Using Asp.Net C#</title>   
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <table>
            <tr><td>
                <asp:Label ID="Label1" runat="server" Text="Address"></asp:Label>
                </td><td><asp:TextBox ID="txtAdd" runat="server"></asp:TextBox>
                </td></tr>
            <tr><td>
                <asp:Label ID="Label2" runat="server" Text="City"></asp:Label>
                </td><td>
        <asp:TextBox ID="txtCity" runat="server"></asp:TextBox>
                </td></tr>
            <tr><td>
                <asp:Label ID="Label3" runat="server" Text="Country"></asp:Label>
                </td><td>
        <asp:TextBox ID="txtCountry" runat="server" style="height22px"></asp:TextBox>
                </td></tr>
            <tr><td class="auto-style1">
                <asp:Label ID="Label4" runat="server" Text="Same As Paste Below"></asp:Label>
                </td><td>
        <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged" />
                </td></tr>
            <tr><td>
                <asp:Label ID="Label5" runat="server" Text="Address"></asp:Label>
                </td><td>
        <asp:TextBox ID="txtcopyAdd" runat="server"></asp:TextBox>
                </td></tr>
            <tr><td>
                <asp:Label ID="Label6" runat="server" Text="City"></asp:Label>
                </td><td>
        <asp:TextBox ID="txtCopyCity" runat="server"></asp:TextBox>
                </td></tr>
            <tr><td>
                <asp:Label ID="Label7" runat="server" Text="Country"></asp:Label>
                </td><td>
        <asp:TextBox ID="txtCopyCountry" runat="server"></asp:TextBox>
                </td></tr>
           
        </table>
      
    </div>
    </form>
</body>
</html>


            C# CODING

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls; 
public partial class Default2 : System.Web.UI.Page
{    protected void Page_Load(object sender, EventArgs e)
    { 
    }
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox1.Checked == true)
        {
            txtcopyAdd.Text = txtAdd.Text.ToString();
            txtCopyCity.Text = txtCity.Text.ToString();
            txtCopyCountry.Text = txtCountry.Text.ToString();
        }
        else
{ 
            txtcopyAdd.Text = "";
            txtCopyCity.Text = "";
            txtCopyCountry.Text = "";

        }
    }

}







0 comments:

Post a Comment