Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Javascript control of server controls
Message
 
 
To
04/02/2009 11:34:32
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01379233
Message ID:
01379243
Views:
13
>>>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
>>
>>Try to add your JS function in run-time with Attributes.Add method.
>
>Thanks Naomi. Umm. . . I don't think I know how to do that and btw how would that help? The function is there and it operates. It just can't overcome the span setting.

Doing it in run-time you can pass the myControl.ClientID to the function.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform