We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to enable/disable a CurrencyTextBox in client side script ?

How to enable/disable a CurrencyTextBox in client side script ?

thanks for your support !


6 Replies

VK Vinoth Kumar K Syncfusion Team January 7, 2008 07:49 PM UTC

Hi Faleh,

Thanks for using Syncfusion products.

You can enable/disable a CurrencyTextBox in client side script by using the below given snippet

//Java Script
function DisableCurrencyControl( )
{
var elem = document.getElementById('CurrencyTextBox1');
if (elem != null)
{
// toggle the disabled status
elem.disabled = !elem.disabled;
}
}

Please refer the sample in the below link which illustrates the above

http://websamples.syncfusion.com/samples/Tools.Web/6.1.0.34/F70881/main.htm


Please let me know if you have any questions.

Regards,
Vinoth




FA Faleh January 8, 2008 11:27 AM UTC

Sorry But that doesn't work well.

In your example the CurrencyTextBox looks disable but we can change the text inside.





VK Vinoth Kumar K Syncfusion Team January 8, 2008 05:54 PM UTC

Hi Faleh,

Thanks for using Syncfusion products.

Please refer to the updated sample.

Sample link:

http://websamples.syncfusion.com/samples/Tools.Web/6.1.0.34/FF70881/main.htm


Let me know if you have any questions.

Regards,
Vinoth




FA Faleh January 10, 2008 08:01 AM UTC

The currency textbox is not totaly disabled
the (increment and decrement) are not disabled
so if we click on it, that causes a javascript error.

how to avoid this error ?



VK Vinoth Kumar K Syncfusion Team January 10, 2008 10:09 PM UTC

Hi Faleh,

Thanks for using Syncfusion products.

Please refer to the updated sample that shows you "How to enable/disable the CurrencyTextBox Control using ClientScript?".

Sample link:
http://websamples.syncfusion.com/samples/Tools.Web/6.1.0.34/FFF70881/main.htm


Let me know if you have any questions.

Regards,
Vinoth




SS Suresh Sekarean Syncfusion Team January 11, 2008 03:12 PM UTC

Hi Faleh,

If the CurrencyTextBox is disabled from the server side, all its child controls are disabled and also Client events like mouseup,mousedown are not registered to the DOM. But if we disable the control in Client side, it's Client events are still attached with DOM and causes the error.

Also these events would not be fired if Client Object of the control is null. So these event can be prevent to trigger if the Client Object of the control is removed from the window object. Please refer the below code to create/remove the Client Object of the control.

[Javascript]

//Remove Control Client Object from the window object
window["Numeric"]=null;

//Create new Client Object model to the control
window["Numeric"] = new SF_NumericTextBox("NumericTextBox1");

Please refer the below sample which illustrates the above.

http://websamples.syncfusion.com/samples/Tools.Web/6.1.0.34/F70881_1/main.htm

Thanks for using Syncfusion products.

Regards,
Sureshsekaran.


Loader.
Live Chat Icon For mobile
Up arrow icon