Click here to Skip to main content
15,796,734 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Used A function like CheckBox Checked Enable Textbox, It is working fine but On clicking edit button in grid view row A pop up appears with all row columns in edit mode but this check box isn't checked and textbox is not enabled

I have used web method to get all the rows of grid row and used a prop
JavaScript
[webmethod] $('<%=chk.clientid%>').prop('checked', obj.kmc)
this is checking the checkbox but how to enable the text box
JavaScript
$('<%=txt.clientid').val(obj.txt);
this should enable on row only if check box checked

any ideas??

help ??

What I have tried:

this function working on textbox normally, but on row edit in gridview it isnt

JavaScript
function changevalue(checkbox) {              
            document.getElementById('&lt;%= inputKmcCode.ClientID%>').style.display = checkbox.checked ? 'block' : 'none';
        }       
    &lt;/script
Posted
Updated 10-Mar-17 2:00am
v4

1 solution

Please try the below inside the javascript function when you call on change of checkbox

JavaScript
function changevalue(checkbox) {
var chkbox = $(document.getElementById(checkbox));
var textboxId = chkbox.replace('checkbox id', 'textboxid');
if(chkbox.checked)
{
$('#<%=textboxId.ClientID%>').removeAttr("disabled", "disabled");
or
document.getElementById('<%=%=textboxId .ClientID%>').disable=false;
}
}
 
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