Click here to Skip to main content
15,917,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to assign one tab value to another tab if both using text box and also tabs are on same page using java script.
Posted

1 solution

Hi,

we can set and get input values in javascript

Tab is nothing but div tags after rendering so it is possible

for eg.

page has two tabs like..AddCategory,ShowCategory

then if you check in view source the control id s in both tabs are like ...

"AddCategory_TextBox1_0_1" and ShowCategory_TextBox2_0_1

in javascript we write this code for assigning value in one textbox into another

JavaScript
document.getElementByID("AddCategory_TextBox1_0_1").Value=document.getElementByID("ShowCategory_TextBox2_0_1").Value;


or
JavaScript
document.getElementbyID("<%=TextBox1.ClientID%>").Value=document.getElementbyID("<%=TextBox2.ClientID%>").Value

Here we can pass ids to this method dynamically.

from server side.

if you specify your code I can explain more.
I hope you understood What I said.

Here i'm adding this code

HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script language ="javascript" >
        function checkb() {
            $("#<%=TextBox1.ClientID %>").val($("#<%=TextBox2.ClientID %>").val());
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server">
        <asp:TextBox ID="TextBox2" runat="server">
        <input id="btncheck" type ="button"  value ="check" onclick ="checkb()" />
    </div>
    </form>
</body>
</html>


All the Best
 
Share this answer
 
v2
Comments
rajjosh 26-Sep-11 11:55am    
document.getElementById("<%=txtCoBorrContAddress1%>").Value = document.getElementById("<%=txtConEmpAddr1.ClientID%>").Value
as per u r solution i am declare it on java script function but still i am getting error value is undefine
rajjosh 26-Sep-11 11:58am    
Microsoft JScript runtime error: Unable to set value of the property 'Value': object is null or undefined
Muralikrishna8811 27-Sep-11 4:28am    
you don't know jquery

properties are different in jquery objects try Val() or text()
Muralikrishna8811 27-Sep-11 4:36am    
Hi I post clear code check like that

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900