Click here to Skip to main content
15,895,786 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
if check the CheckBox, TextBox Value is Bind to Another TextBox In the Same Page

Please help Me
Posted

Try this:

Set Autopostback = true for checkbox
C#
if(CheckBox1.Checked == true)
 {
     textbox1.Text = textbox2.Text;
 }
 
Share this answer
 
v2
Comments
praveen kadimi 19-Nov-13 5:25am    
I am enter the text into Textbox1 then Check the CheckBox Textbox1 Value is gone (There is no data avaliable in the textBox1 and Textbox2)
Tom Marvolo Riddle 19-Nov-13 5:53am    
buddy i checked it.works perfectly.
Tom Marvolo Riddle 19-Nov-13 5:53am    
post your code.I will try to fix it.
praveen kadimi 19-Nov-13 6:11am    
<asp:CheckBox ID="chkpadd" runat="server" Text="Same As Present Address"
AutoPostBack ="true" oncheckedchanged="chkpadd_CheckedChanged1" />


protected void chkpadd_CheckedChanged1(object sender, EventArgs e)
{
{

if (chkpadd.Checked == true)
{
txtadd1.Text = txtpadd1.Text;
}
}
Tom Marvolo Riddle 19-Nov-13 6:32am    
put this code in page_load
if (chkpadd.Checked == true)
{
txtadd1.Text = txtpadd1.Text;
}
Use JQuery To Bind value in Another Text Box


HTML
<input type="checkbox" id="similaradd" />Similar To Above
<input type="text" id="txt1" />
<input type="text" id="txt2" />


JavaScript
$("#similaradd").click(function (event) {
   val text1 = $("#txt1").val();
   if(this.checked)
   {
      $("txt2").val(text1);
   }
   else
   {
      $("txt2").val("");
   }
});
 
Share this answer
 

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