subash
subash

Reputation: 4137

disable aspxdateedit control in javascript

iam using aspx date edit control in my asp.net and c#.net application. is it possible to disable aspxdateedit control in javascript?if so how acan that be done.becoz ,i tried

using

"document.get elementbyid("datedit").disabled=true;"

but it didn't worked out !!

any suggestion on this?

Upvotes: 1

Views: 5757

Answers (2)

Niranjan Singh
Niranjan Singh

Reputation: 18290

First of all set the control's ClientInstanceName property to access the control at client side.

 <dx:ASPxButton ID="btnSubmit" runat="server" Text="Save" AutoPostBack="false"
                Width="120px" **ClientInstanceName="btnSave"**><ClientSideEvents Click="OnButtonClientClick" />
        </dx:ASPxButton>

Now you can do this in two ways as:

ClientSideEvents Click="function(s, e) {document.getElementById('btnSave').enabled = false;}"

Have can try this also:

ClientSideEvents Click="function(s, e) {btnSave.SetEnabled(false);}"

you can also access these controls in javascript code at aspx page either in a callback event or some other client side method.

just access the control with their associated client instance name as i have btnSave for my ASPxButton

btnSave.SetEnabled(false);

get more information about these control's methods and client events etc. see the clientscript namespace of these aspxEditors DevExpress.Web.ASPxEditors.Scripts Namespace

hope you will get your solution or help to solve your problem here..

Happy Coding..

Upvotes: 1

DevExpress Team
DevExpress Team

Reputation: 11376

This can be done using the editor's client side SetEnabled method. I.e.

// JS

dateEdit.SetEnabled(false);

Note, here the dateEdit is the editor's ClientInstanceName property value. It allows you to define the name of the java script client side object. Using it, you will be able to access its client side properties and methods.

Upvotes: 2

Related Questions