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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting the value using javascript after initialisation

Thread ID:





125152 Jul 22,2016 11:40 AM UTC Jul 26,2016 11:08 AM UTC ASP.NET MVC 1
Tags: NumericTextbox
Lewis Hamill
Asked On July 22, 2016 11:40 AM UTC

I have declared a numeric text box in my markup:

<ej:NumericTextBox ID="ntbTotal" runat="server" MinValue="0" WatermarkText="" 
                                        ReadOnly="true" CssClass="stock-open-total" ShowSpinButton="false" />

I want to access the textbox in javascript and update the value as a sum of other numeric text boxes with the class "stock-open-val".

So far I have come up with the code below. Getting the values works fine however I haven't found a way to select the total numeric text box and update the value.

function stockOpeningCalc(inst, args) {
    var openValTBs = $(".stock-open-val .e-numerictextbox");

    var openTotal = 0;

    for (var i = 0; i < openValTBs.length; i++)
        var value = openValTBs[i]["value"];
        if ($.isNumeric(value)) openTotal += parseFloat(value);

    //set value here

Ashokkumar Balasubramanian [Syncfusion]
Replied On July 26, 2016 11:08 AM UTC

Hi Lewis, 
Thanks for using Syncfusion Products. 
We have analyzed your requirement (“To set the Value to Numeric Textbox”).We can use the Value property to set the value for textbox control. 
Please refer the below code. 
function myFunction(inst,args) { 
        var openValTBs = $(".stock-open-val .e-numerictextbox"); 
        var openTotal = 0; 
        for (var i = 0; i < openValTBs.length; i++) 
            var value = openValTBs[i]["value"]; 
            if ($.isNumeric(value)) openTotal += parseFloat(value); 
        $("#ntbTotal").ejNumericTextbox("instance").option({ value: openTotal }); 
As per requirement, we have prepared a sample and the sample can be downloaded from the following location. 
Sample Location: Textboxes 
To know more about the api configuration, please refer the below link. 
Please let us know whether the provided sample is helpful in achieving your requirement or not. If you have any other queries, please get back to us with additional information, we will happy to assist you.  
Ashokkumar B


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon