I have one checkbox when i check that checkbox the value of other text box should be assigned to that text box and it get disabled ,but when i unchecked it user should input his own value.
Once i check and insert the same values it get saved to that value, but next time when i update the text boxes i am not able to read new values.
My Javascript function is like this.
function SetValues(ObjId) {
if (document.getElementById(ObjId).checked) {
document.getElementById('<%= txtBillAddr1.ClientID %>').value =
document.getElementById('<%= txtadress.ClientID %>').value;
document.getElementById('<%= txtBillAddr2.ClientID %>').value =
document.getElementById('<%= txtAddr2.ClientID %>').value;
document.getElementById('<%= txtBillCity.ClientID %>').value =
document.getElementById('<%= txtCity.ClientID %>').value;
document.getElementById('<%= txtBillState.ClientID %>').value =
document.getElementById('<%= txtState.ClientID %>').value;
document.getElementById('<%= ddlBillCountry.ClientID %>').value =
document.getElementById('<%= ddlcountry.ClientID %>').value;
document.getElementById('<%= txtBillZipCode.ClientID %>').value =
document.getElementById('<%= txtZIP.ClientID %>').value;
document.getElementById('<%= txtBillContctperson.ClientID %>').value =
document.getElementById('<%= txtcontactperson.ClientID %>').value;
document.getElementById('<%= txtBillPhNo.ClientID %>').value =
document.getElementById('<%= txtPhone.ClientID %>').value;
document.getElementById('').setAttribute("readonly", "readonly");
document.getElementById('').setAttribute("style", "background-color:#DCDCDC");
document.getElementById('').setAttribute("readonly", "readonly");
document.getElementById('').setAttribute("style", "background-color:#DCDCDC");
document.getElementById('').setAttribute("readonly", "readonly");
document.getElementById('').setAttribute("style", "background-color:#DCDCDC");
document.getElementById('').setAttribute("readonly", "readonly");
document.getElementById('').setAttribute("style", "background-color:#DCDCDC");
document.getElementById('').setAttribute("readonly", "readonly");
document.getElementById('').setAttribute("style", "background-color:#DCDCDC");
document.getElementById('').setAttribute("readonly", "readonly");
document.getElementById('').setAttribute("style", "background-color:#DCDCDC");
document.getElementById('').setAttribute("readonly", "readonly");
document.getElementById('').setAttribute("style", "background-color:#DCDCDC");
document.getElementById('').setAttribute("readonly", "readonly");
document.getElementById('').setAttribute("style", "background-color:#DCDCDC");
}
else {
document.getElementById('').removeAttribute("readonly");
document.getElementById('').setAttribute("style", "background-color:#FFFFFF");
document.getElementById('').removeAttribute("readonly");
document.getElementById('').setAttribute("style", "background-color:#FFFFFF");
document.getElementById('').removeAttribute("readonly");
document.getElementById('').setAttribute("style", "background-color:#FFFFFF");
document.getElementById('').removeAttribute("readonly");
document.getElementById('').setAttribute("style", "background-color:#FFFFFF");
document.getElementById('').removeAttribute("readonly");
document.getElementById('').setAttribute("style", "background-color:#FFFFFF");
document.getElementById('').removeAttribute("readonly");
document.getElementById('').setAttribute("style", "background-color:#FFFFFF");
document.getElementById('').removeAttribute("readonly");
document.getElementById('').setAttribute("style", "background-color:#FFFFFF");
document.getElementById('').removeAttribute("readonly");
document.getElementById('').setAttribute("style", "background-color:#FFFFFF");
}
}
What I have tried:
I added update panel for that block where my text boxes exists.
Still not working as required.