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

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="height: 22px"></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 = "";

        }
    }

}



First Add New Web Form - Select TextBox,CheckBox From ToolBox  - CheckBox [F4]-Property - AutoPostBack=True 





Next - Double Click CheckBox - Add Below C# Coding 






Email Send in Web Service,HtmlPage Using Asp.Net C# JQuery

Email Send in Web Service,HtmlPage Using  Asp.Net C# JQuery

Email Send To Users  Using Web Service & HtmlPage.html  in JQuery,JavaScript With GoogleApis in Asp.Net C#(Without Using WebForm).

                             Download Coding
                                                 Download

                                      DEMO



                       HTML CODING(HtmlPage.html)


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>

    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css"
        rel="stylesheet" type="text/css"/>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
    <script>
        function SendMail() {
            $("#Button1").click(function () {
                $.ajax({
                    url: "WebService.asmx/MailSend",
                    data: "{ 'To': '" + $('input[id$=Text1]').val() +
                  "', 'Message': '" + $('input[id$=Text2]').val() + "' }",
                    dataType: "json",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    success: function (data) {
                        if (data.d == 1) {
                            alert('Success');                         
                        }
                    }
                });
            });
        }
</script>  
 
</head>
<body>
    <table><tr><td>To</td><td>
    <input id="Text1" type="text" /></td></tr>
        <tr><td>Message</td><td>
    <input id="Text2" type="text" /></td></tr>
        <tr><td colspan="2">
    <input id="Button1"  type="button"  onclick ="SendMail();" value="SEND MAIL"  /></td></tr>

    </table>
</body>

</html>
                           Web Service.asmx


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Net.Mail;

/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService {  
    [WebMethod]
    public  int MailSend(string To, string Message)
    {      
        MailMessage Msg = new MailMessage();
        Msg.From = new MailAddress("SenderMail@gmail.com"); // Sender e-mail address.
        Msg.To.Add(To);// Recipient e-mail address.
        Msg.Subject = "Send Mail Using WebServices";
        Msg.Body = Message;
        Msg.IsBodyHtml = true;     
        SmtpClient smtp = new SmtpClient();
        smtp.Host = "smtp.gmail.com";
        smtp.Port = 587;
        smtp.Credentials = new System.Net.NetworkCredential("YourMailId@gmail.com", "Password");
        smtp.EnableSsl = true;
        smtp.Send(Msg);
        return 1;      
    }
   
}



First - Add New HtmlPage.html Form  






Next - Add Input Button.Button From ToolBox






Next - Add - Web Service.asmx From Solution Explorer






Next - Add JQuery,GoogleApi  &  JQuery Function From WebService.asmx






Next - Add - NameSpace(using System.Net.Mail)Email Send Coding  in WebService.asmx  Input Call From HtmlPage.html







Validation in Asp.Net Controls Using JQuery

Validation in Asp.Net Controls Using JQuery

Using Asp.Net Control   Textbox,Dropdownlist,Checkbox Validating The JQuery 

              Download Coding
                          Download

                    DEMO



              HTML CODING



<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Validation in Asp.Net Controls Using JQuery</title>
     <link href="Valid.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://cdn.ucb.org.br/Scripts/formValidator/js/languages/jquery.validationEngine-en.js"
        charset="utf-8"></script>
    <script type="text/javascript" src="http://cdn.ucb.org.br/Scripts/formValidator/js/jquery.validationEngine.js"
        charset="utf-8"></script> 
   
    <script type="text/javascript">
        function FDate(field, rules, i, options) {
            var Valdat = /^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/;
            if (!Valdat.test(field.val()))
            {
                return "Please Enter  dd/MM/yyyy format Date"
            }
        }
    </script>
 
     <script type="text/javascript">
        $(document).ready(function () {
            $("#form1").validationEngine();
        });
</script>
</head>
<body>
    <form id="form1" runat="server">
   <div>
       <br />
       <br />

       <table>
           <tr><td>
               <asp:Label ID="Label1" runat="server" Text="Username"></asp:Label>
               </td><td>
<asp:TextBox ID="txtName" runat="server"  Class="validate[required]" Height="30px" ></asp:TextBox>
                   <br />
                   <br />
               </td></tr>
           <tr><td>
               <asp:Label ID="Label2" runat="server" Text="Age"></asp:Label>
               </td><td>
<asp:TextBox ID="txtage" runat="server" Class="validate[required]"  minlength="2" Height="30px"></asp:TextBox>
                   <br />
                   <br />
                   <br />
               </td></tr>
           <tr><td>
               <asp:Label ID="Label3" runat="server" Text="Email Id"></asp:Label>
               </td><td>
<asp:TextBox ID="txtEmail" runat="server" Class="validate[required,custom[email]]" Height="30px"></asp:TextBox>
                   <br />
                   <br />
               </td></tr>
           <tr><td>
               <asp:Label ID="Label4" runat="server" Text="Mobile Number"></asp:Label>
               </td><td>
        <asp:TextBox ID="txxMobile" runat="server" Class="validate[required,custom[number],minSize[10],maxSize[10]]" Height="30px"></asp:TextBox>
                   <br />
                   <br />
               </td></tr>
           <tr><td>
               <asp:Label ID="Label5" runat="server" Text="Gender"></asp:Label>
               </td><td>

       <asp:DropDownList ID="DropDownList1" runat="server" Class="validate[required]" Height="30px" >
           <asp:ListItem Text="Select Gender" Value=""></asp:ListItem>
           <asp:ListItem Text="Male" Value="male" ></asp:ListItem>
           <asp:ListItem Text="Female" Value="female"></asp:ListItem>
       </asp:DropDownList>

               </td></tr>
           <tr><td>
               <asp:Label ID="Label6" runat="server" Text="Password"></asp:Label>
               </td><td>
<asp:TextBox ID="txtPass" runat="server"  Class="validate[required]" Height="30px"></asp:TextBox>
                   <br />
                   <br />
               </td></tr>
           <tr><td>
               <asp:Label ID="Label7" runat="server" Text="Confirm Password"></asp:Label>
               </td><td>
<asp:TextBox ID="txtRePass" runat="server" Class="validate[required,equals[txtPass]]" Height="30px"  ></asp:TextBox>
                   <br />
                   <br />
               </td></tr>
           <tr><td>
               <asp:Label ID="Label8" runat="server" Text="Website Url"></asp:Label>
               </td><td>
<asp:TextBox ID="txtUrl" runat="server" class="validate[required,custom[url]]" Height="30px">http://</asp:TextBox>
                   <br />
                   <br />
               </td></tr>
           <tr><td>
               <asp:Label ID="Label9" runat="server" Text="Date"></asp:Label>
               </td><td>
        <asp:TextBox ID="txtDate" runat="server" Class="validate[required,funcCall[FDate[]] " Height="30px"></asp:TextBox>
                   <br />
                   <br />
               </td></tr>
           <tr><td>
               <asp:Label ID="Label10" runat="server" Text="Agreement"></asp:Label>
               </td><td>
<input class="validate[required] checkbox" type="checkbox" id="chkAgree"  name="agree" height="30"/><br />
               </td></tr>
           <tr><td colspan="2<asp:Button ID="btnSubmit" runat="server" Text="submit" />
               </td><td>
       </table>
       </div>
</form>

</body>
</html>



First Add New WebForm - Add Require Controls From ToolBox  





Next - Add AjaxGoogleApi - Add Css File & Call Every Control From JQuery Class






Every Controls Add Requierd & Expression Add For CssClass