Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > NumericUpDown > Stop Automatic Round Up - Round Down

Not answered Stop Automatic Round Up - Round Down

Feed from this thread
  • SweNz avatar

    Posted on Aug 19, 2011 (permalink)

    Hi Telerik,

    I've a trouble..

    I set Maximum to 999999 and IsInteger = true which means value can't be more than 999,999 or 6 digits. But when I key in 999999 in my control it round-up and show 1,000,000 ( another i.e. key in 999994 , it round down to 999990 )
    How to turn off automatic round function ?

    this is my XAML
    <telerik:GridViewDataColumn ValidatesOnDataErrors="None" Width="250" DataMemberBinding="{Binding MinAmt}" Header="Minimum Amount" 
                            HeaderTextAlignment="Center" TextAlignment="Right">
    <telerik:GridViewDataColumn.CellTemplate>
    <DataTemplate>
    <TextBlock Text="{Binding MinAmt, StringFormat='0,0'}" TextAlignment="Right" 
                        x:Name
    ="MinAmtTextBlock" Loaded="MinAmtTextBlock_Loaded" />
    </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
    <telerik:GridViewDataColumn.CellEditTemplate>
    <DataTemplate>
                      <telerik:RadNumericUpDown  Maximum="999999" UpdateValueEvent="PropertyChanged" 
                                                ShowButtons="False" PreviewKeyDown="MinAmt_PreviewKeyDown"
            Value="{Binding Amount, Mode=TwoWay, UpdateSourceTrigger=Explicit}" 
                                                x:Name="MinAmt" Loaded="MinAmt_Loaded" />
    </DataTemplate>
    </telerik:GridViewDataColumn.CellEditTemplate>
    </telerik:GridViewDataColumn>

    please give me some advice
    Regard,
    SweNz

    Reply

  • SweNz avatar

    Posted on Aug 21, 2011 (permalink)

    Hi there ,

    Still need help ..

    My business logic is need to set MaxLength or Maximum Value of inputting value (or editing) in a gridview cell.

    Thanks a lot,
    SweNz

    Reply

  • Konstantina Konstantina admin's avatar

    Posted on Aug 24, 2011 (permalink)

    Hello Swenz,

    Sorry, but I was unable to reproduce the described behavior. Would it be possible to send us your project, so that we can run it here locally and track down the source of the problem. In that way we will be able to provide you with solution in a timely manner.

    Looking forward to your reply.

    Regards,
    Konstantina
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

    Reply

  • SweNz avatar

    Posted on Aug 26, 2011 (permalink)

    Hi Konstantina,

    I can't send you a project because it's a company asset. Btw, Can you suggest me how to deal with following business logic in simplest way

    - input field is always in RadGridView
    - can set control maximum input length (like TextBox:MaxLength) from code behind.
    - input data accepts only Numeric (digit)
    - can validate input value after user fill in that control
    - can use String Format for add comma ig. if user fill 87654321 after RowEditEnded in ViewMode must shows 87,654,321

    looking for your response
    Thank you,
    SweNz

    Reply

  • Sébastien avatar

    Posted on Sep 12, 2011 (permalink)

    I have a similar problem, and you can reproduce it with your own Q2 2011 samples.
    In the NumericUpDown examples, go to the Theming demo, then use the top numeric control, with label NUMERIC FORMAT.
    We're trying to use the control to enter credit card numbers. If you try something like 6666666666666012, the control will display
    6,666,666,666,666,010, where the last digit is always rounded. If I had entered .....6015, I would have ended up with ......6020.
    What's happening here ? The control is bound to a UInt64. Does the control badly support 64-bit numerals ?

    Thanks,
    Sebastien

    Reply

  • Pana Pana admin's avatar

    Posted on Sep 16, 2011 (permalink)

    Hello Sébastien,

    If you are about to enter creadit card numbers I would ask you to consider using RadMaskedInput.

    Regards,
    Pana
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Sébastien avatar

    Posted on Sep 16, 2011 (permalink)

    It's not ALWAYS a credit card. We have to support multiple card formats, but it has to be a Numeric control.
    Please tell me how to disable the rounding on the Numeric control.

    Sébastien

    Reply

  • Pana Pana admin's avatar

    Posted on Sep 19, 2011 (permalink)

    Hi,

    The

    Debug

     

     

    .WriteLine(((double)(6666666666666012)).ToString("F"));

     

    Outputs a 66666666666666010 and the RadNumericUpDown uses a double inside. I believe we are not going to change that.
     
    I would suggest you if you are using the field for different cards to use a different approach. For example the user may chose the card type and a different input control would appear for the different types making it using a MaskedInput with different masks for different card types and if a shorter double or int value is required - use numeric.

    I am sorry for the inconvenience.

    Kind regards,
    Pana
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > NumericUpDown > Stop Automatic Round Up - Round Down
Related resources for "Stop Automatic Round Up - Round Down"

WPF NumericUpDown Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]