Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Javascript control of server controls
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01379233
Message ID:
01379261
Views:
23
>>In simplified language . . I have a webpage that contains a formview with 2 checkboxes inside its edititemtemplate. Checkbox1 is enabled and checkbox2 is disabled. The desired action is for checkbox2 to become enabled when checkbox1 is checked. I have a JS that will do this (almost). The JS is triggered by the onclick event of checkbox1.
>>
>>Hmm . . It seems the website won't let me include the JS here. Anyone know how to do it?
>>
>>The script is positioned inside the edititemstemplate so that the checkboxes do in fact exist when the script loads. My problem is that although the checked property changes as expected, the enabled property does not, UNLESS the default condition of the checkbox2 (dh410) is enabled. If its enabled by default, it will toggle back and forth just fine. But if the default condition is disabled it will not. I find that the framework compilation is wrapping the checkbox inside a span which is also set to disabled and it seems this is preventing the checkbox from being activated by the script. It looks like this
>>
>><span class="ckbox2" disabled="disabled"><input id="ctl00_ContentPlaceHolder1_FormView1_dh410CheckBox" type="checkbox" name="ctl00$ContentPlaceHolder1$FormView1$dh410CheckBox" disabled="disabled" /><label for="ctl00_ContentPlaceHolder1_FormView1_dh410CheckBox">4/10</label></span>
>>
>>So, can someone here help me figure this out?
>>Thanks
>
>I haven't tested this, so it might not work. You should be able to access the wrapping span in your javascript using code similar to this:
>
>
>function EnableOtherControl()
>{
>   chkNameOfCheckbox.disabled = false;
>   chkNameOfCheckbox.parentNode.disabled = false;
>}
>
Paul - You are wonderful. Thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform