Need JScript code to put same ASP.net Textbox value in another Textbox (same page / same form)

Need simple JavaScript Solution to Put Same ASP.net text box text values into another ASP.net textbox on the same form and same page...

I have this working in asp.net runat with vb.net code and onkeypress call code BUT the postback re-positioning is irritating including trying to suppress it with maintain...

JScript should cause no post back i assume and be quite easy ?

<%@ Page Language="VB" AutoEventWireup="false" Debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data"%>\
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.data.OleDb" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>

<script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub

    Private Sub MyTextBox_TextChanged(sender As Object, e As EventArgs) Handles MyTextBox.TextChanged
        AddTextBox.Text = MyTextBox.Text
    End Sub
</script>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body> 
  <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="MyTextBox" runat="server" onkeypress="AddTextBox_TextChanged" AutoPostBack="true"></asp:TextBox>
        <asp:TextBox ID="AddTextBox" runat="server" Enabled="False" ReadOnly="True"></asp:TextBox>
    </div>    
  </form>
</body>
</html>

Open in new window

EnflowAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chinmay PatelChief Technology NinjaCommented:
Hi Enflow,

Assuming you are not using Jquery

<script>
function copyValues()
{
document.getElementById("TARGET TEXTBOX's ID").value = document.getElementById("SOURCE TEXTBOX's ID").value;
}
</script>

Open in new window


Regards,
Chinmay.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
EnflowAuthor Commented:
Working Now ... Thanks...

Function JS code:

function matchSigs() {document.getElementById("AutoSN_1").value = document.getElementById("SN_1").value;}

Here is Source ASP.NET Textbox

<asp:TextBox ID="SN_1" runat="server" Height="25px" Width="340px" Wrap="False" BackColor="#EAF4FF" Font-Size="Large" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" ToolTip="Head of Household Types In Their Full Name Signature Here" onchange"javascript;matchSigs();"></asp:TextBox>

Here is TARGET ASP.NET Textbox

<asp:TextBox ID="AutoSN_1" runat="server" Height="25px" Width="270px" Wrap="False" BackColor="#F2F2F2" Font-Size="Large" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" ToolTip="Applicant's Signature Goes Here Automatically" Enabled="False" ReadOnly="True"></asp:TextBox>
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.