Can someone please tell me how to disable and enable the dropdown in javascript. I don't need to cancel the value changed event or just give the appearance of being disabled, I really need it disabled, and the ability to enable it again. I need the control to be disabled\enabled when other controls on the page perform certain actions. I don't see why this has to be so hard. The help for the CSOM for the new AJAX controls is so poor in comparison to the help for the old controls it is laughable.
Hi,
It's actually pretty easy:
var dropDown = $find("WebDropDown1");
dropDown.set_enabled(false);
dropDown.set_enabled(true);
that's from the client-side. you will need to use the latest service release. (Please let me know if this is not working in the latest service release).
From the server-side, you can set Enabled property to false.
Also you can set DropDownMode=DropDownList or ReadOnly, if you just don't want to allow editing during runtime.
Hope it helps,
Angel
I have tried the ablove mentioned solution to diable the WebDropDown it is working as expexted i.e.
but however after post back
dropDown.set_enabled(fasle); is not working , kindly let me know what could be causing the issueThnaks in Advance
This is not working for me, is there something special I need to do?
Is there a special place I need to put the javascript?
Hi Try to do the Following :
In Your JavaScript use the Following Code:
$find('igDropdown').set_enabled(false);
where igDropdown is the ID of the WebDropDown
Thanks
I can get it to work after the page is fully loaded and I click a checkbox to run the javascript, but I need it to run as the page is loaded. See my attachment for what I am looking to do.
You can run your own code on each page load as you subscribe to the "Initialize" client-side event of the control:
E.g:
The control setup :
<ig:WebDropDown ID="WebDropDown1" runat="server" Width="200px"> <ClientEvents Initialize="InitializeHandler" /> </ig:WebDropDown>
Javascript handler:
<script type="text/javascript"> function InitializeHandler(sender, args) { // put your code here to disable the control } </script>