I have a gridview , in the gridview i have a edit column, if we click edit button all the values will appear in a modal popup, if the checkbox is checked textboox with value we should display if the checkbox is unchecked text box should be hidden, these values are coming from database, i am making an ajax call to get the values this is my code.
function Edit(ID) {
$.ajax({
url: 'Target.aspx/GetCode?ts=' + $.now(),
contentType: 'application/json',
type: 'POST',
data: JSON.stringify({ id: ID }),
success: function (res) {
var obj = JSON.parse(res.d);
$('#<%=hdnId.ClientID%>').val(ID);
$('#<%=Groups.ClientID%>').val(obj.MainID).change();
$('#<%=Manage.ClientID%>').val(obj.ManageID).change();
$('#<%=txtOne.ClientID%>').val(obj.OneVal);
$('#<%=txttwo.ClientID%>').val(obj.twoval);
$('#<%=checkbox1.ClientID%>').prop('checked', obj.ischecked);
if (obj.ischecked == false) {
// $('#<%=txtboxchk.ClientID%>').prop('disabled', 'false');
$('[id$=txtboxchk]').prop('disabled', true);
// $('#<%=txtboxchk.ClientID%>').prop("disabled", "disabled");
$('#<%=txtboxchk.ClientID%>').val('');
}
if (obj.ischecked == true) {
$('[id$=txtboxchk]').prop('disabled', false);
// $('#<%=txtboxchk.ClientID%>').prop('enabled', 'true');
$('#<%=txtboxchk.ClientID%>').val(obj.txtcodepresent);
// $('#<%=txtboxchk.ClientID%>').prop('disabled', 'false');
// txtboxchk.Enabled = true;
}
},
error: function (err) {
}
});
}
this is my code , when checked textbox with value is shown in textbox and checkbox is checked.but when unchecked it just needs to hide its textbox that i am unable to do please help??