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.
Unfortunately, activation email could not send to your email. Please try again.

How i can get value in numeric textbox (ej:NumericTextBox) from JS?

Thread ID:

Created:

Updated:

Platform:

Replies:

131935 Aug 3,2017 06:46 AM Aug 4,2017 08:44 AM ASP.NET MVC 1
loading
Tags: NumericTextbox
tomer
Asked On August 3, 2017 06:46 AM

Hi,
How can I alert the NumericTextBox value?

<ej:Dialog ID="Dialog199" Title="Sample" runat="server">
    <DialogContent>
        <div>
            <br />
            Your dialog contents here 
            <br />
            <ej:NumericTextBox runat="server" ID="num1" Value="3"></ej:NumericTextBox>
            <br />
            <ej:Button runat="server" ID="button1" Text="OK" ClientSideOnClick="btnOK"></ej:Button>
            <ej:Button runat="server" ID="button2" Text="Cancel"></ej:Button>
        </div>
    </DialogContent>
</ej:Dialog>


<script type="text/javascript">

    function btnOK() {

        var dialogObj = $("#<%=Dialog199.ClientID%>").data("ejDialog");
        dialogObj.close();

        var num1Obj = $("#<%=num1.ClientID%>").ejNumericTextBox("instance");
        alert(num1Obj.value()); ???
        
    }

</script>

Thanks,
   Tomer

Kaviyarasu Sivasenapathi [Syncfusion]
Replied On August 4, 2017 08:44 AM

Hi Tomer, 
Thanks for contacting Syncfusion support. 
We have analyzed your query (“Not able to get the numeric textbox value”). You can achieve your requirement by using getValue() method of “NumericTextbox” component. Please refer the below code block. 
[CSHTML] 
 
<div id="ControlRegion"> 
    <div class="control"> 
        @{Html.EJ().Dialog("basicDialog").Title("Dialog").Width("550px").Height("200px").ContentTemplate(@<div> 
 
            @Html.EJ().NumericTextbox("numeric").Value(35).Width("400px") 
 
            @Html.EJ().Button("ok").Text("OK").ClientSideEvents(evt => evt.Click("btnOK")).Width("70px").Height("30px") 
 
            @Html.EJ().Button("cancel").Text("CANCEL").Width("70px").Height("30px") 
 
        </div>).Render();} 
    </div> 
</div> 
 
[script] 
 
<script> 
    function btnOK(args) { 
        var dialogObj = $("#basicDialog").data("ejDialog"); 
        dialogObj.close(); 
        var num1Obj = $("#numeric").data("ejNumericTextbox"); 
        alert("current value is: " + num1Obj.getValue()); 
    } 
</script> 
 
For your convenience, we have attached the sample below.  
To know more details about getValue() method, please refer the following documentation link  
Please let us know if you need further assistance on this. 
 
Regards, 
Kaviyarasu S   


CONFIRMATION

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.

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.

;