I have a button which i want to enable when a checkbox is checked. I did it successfully by setting the AutoPostBack of the checkbox to true, when i check it, the page reloads and the button is enabled. But the problem is I want to do this without the page being reloaded. Is there a way to do it without the use of javascript?
I tried creating a javascript function as follows:
<script language="javascript">
function EnableButton(obj) {
document.getElementById('<%=btnNext.ClientID%>').disabled=!obj.checked; }
</script>
and i called this function "EnableButton" on my aspx source page on the Checkbox property adding "oncheckedboxchanged="EnableButton" I don't see anything wrong here but when compiling it says "register.aspx does not contain a definition for 'EnableButton'
where am i going wrong?
any help would be appreciated
thanks, i did it finally and i didn't have to use ClientID or anything. i just used the control names. long story. thanks again
There is only one way to do this, that is using javascript which does not requires page reload.
You cannot direct drop script tag as in HTML page, there is a different way of adding javascript to aspx page.