Pissu Pusa
Pissu Pusa

Reputation: 1374

Check if Devexpress aspxhtmlControl is enabled or disabled from jquery

I have this page which is a settings page which uses AspxHtmlEditor which can be enabled or disabled based on some configurations which have been saved from a different page. So what I need to do is check if the htmleditor is disabled and if so disable some controls when the page is loading. I am using JQuery for this purpose. What is the way to access if the editor is enabled?

I tried using ('#myeditor').is(':disabled') but it didnt work as it always returns false.

Upvotes: 0

Views: 784

Answers (2)

andrews
andrews

Reputation: 2173

You need to set the ClientInstanceName attribute of your ASPxHtmlEditor like the following:

<dvx:ASPxHtmlEditor ID="myeditor" runat="server" ClientInstanceName="myeditor">
... the rest of customizations goes here ...
</dvx:ASPxHtmlEditor>

then in JavaScript you can reference the editor's client object directly using ClientInstanceName, no need to call jQuery over it. So to disable the above editor you can just call:

myeditor.SetEnabled(false);

To check if the editor is enabled at Client side you need to call:

myeditor.GetEnabled();

Also DX controls with the defined ClientInstanceName can be referenced using JS window global var like the following:

window.myeditor.SetEnabled(false);

or

window["myeditor"].SetEnabled(false);

HTH

Upvotes: 1

KSib
KSib

Reputation: 911

Depending on how you named your control to be accessible in Javascript as outlined here: https://documentation.devexpress.com/#AspNet/CustomDocument9150 (scroll down to "How to Access an Extension on the Client")

Then you should just be able to use myeditor.clientEnabled and it will return true or false.

Upvotes: 0

Related Questions