RadNumeric Textbox in RadGrid Allowing more than 2 decimal Digits

2 posts, 1 answers
  1. Atchut
    Atchut avatar
    51 posts
    Member since:
    Apr 2012

    Posted 07 May 2012 Link to this post


    I am having rad numeric textbox in a Radgrid.
    I dont want to allow more than 2 digits after decimal. Below is numeric textbox. It is not working.

      <telerik:GridTemplateColumn HeaderText="Price" UniqueName="Price">
                            <telerik:RadNumericTextBox  ID="txtNewPrice" runat="server" MaxLength="10" AutoCompleteType="None"  CssClass="CurPriceTxtbox" 
                                      Width="50px"     Type="Number" ShowSpinButtons="false" AllowOutOfRangeAutoCorrect="false" InvalidStyle-Font-Bold="true">
                                          <NumberFormat AllowRounding="false" DecimalDigits="2"  KeepNotRoundedValue="true" GroupSizes="3"/>
                                          <ClientEvents OnValueChanging="ValueChanged" OnError="HandleError"/>
  2. Answer
    Eyup avatar
    3953 posts

    Posted 10 May 2012 Link to this post

    Hello Atchut,

    I have tried the provided sample code and everything works as expected on my side. Please keep in mind that NumberFormat-DecimalDigits applies after typing is finished, namely - after the input loses focus.

    However, if you want do disable entering dynamically after the second digit, you could use OnKeyPress client event as shown below:
    <ClientEvents ... OnKeyPress="keyPressed" />
    function keyPressed(sender, args) {
         var value = sender.get_value() * 10;
         if (value - parseInt(value) != 0) {

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top