Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to specify Numeric Format i.e Numeric part and decimal part?

How to specify Numeric Format i.e Numeric part and decimal part?

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ansriharsha
    wrote on last edited by
    #1

    Hi , i want to specify the maximum number of digits for numeric part and the Decimal part in a text box. i tried specifying precision and maxlength of the text box but then it if we input the max length then the precesion cannot be inputted and it gets resetted to the maxamount which should not be possible. like if Maxlength=8 precsion = 2 input required:123456.90 possible input required : 12345678.89 which is not possible so is there any way we could specify the format of the numeric part and as well the decimal part. which would restrict for only that particular input format. like : dddddddd.dd thanks in advance.... cheers, sriharsha

    M S 2 Replies Last reply
    0
    • A ansriharsha

      Hi , i want to specify the maximum number of digits for numeric part and the Decimal part in a text box. i tried specifying precision and maxlength of the text box but then it if we input the max length then the precesion cannot be inputted and it gets resetted to the maxamount which should not be possible. like if Maxlength=8 precsion = 2 input required:123456.90 possible input required : 12345678.89 which is not possible so is there any way we could specify the format of the numeric part and as well the decimal part. which would restrict for only that particular input format. like : dddddddd.dd thanks in advance.... cheers, sriharsha

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      You can use regular expressions to do the validation. In between, do you how to build a regular expression for this?

      Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      A 1 Reply Last reply
      0
      • M Manas Bhardwaj

        You can use regular expressions to do the validation. In between, do you how to build a regular expression for this?

        Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        A Offline
        A Offline
        ansriharsha
        wrote on last edited by
        #3

        hi, but what is the validation expression we need to give for it. i tried giving ; but does not work properly. Thanks and Regards, sriharsha

        1 Reply Last reply
        0
        • A ansriharsha

          Hi , i want to specify the maximum number of digits for numeric part and the Decimal part in a text box. i tried specifying precision and maxlength of the text box but then it if we input the max length then the precesion cannot be inputted and it gets resetted to the maxamount which should not be possible. like if Maxlength=8 precsion = 2 input required:123456.90 possible input required : 12345678.89 which is not possible so is there any way we could specify the format of the numeric part and as well the decimal part. which would restrict for only that particular input format. like : dddddddd.dd thanks in advance.... cheers, sriharsha

          S Offline
          S Offline
          Sun Rays
          wrote on last edited by
          #4

          Hi, you want the same ? string strD= 1000.1234; int dI =strD.indexof("."); string DecimalVal=strD.substring(dI,dI+1); string strVal=strD.substring(0,dI); Hope it will help you.. :-O

          Thanks, Sun Rays To get something you must have to try once. My Articles

          A 2 Replies Last reply
          0
          • S Sun Rays

            Hi, you want the same ? string strD= 1000.1234; int dI =strD.indexof("."); string DecimalVal=strD.substring(dI,dI+1); string strVal=strD.substring(0,dI); Hope it will help you.. :-O

            Thanks, Sun Rays To get something you must have to try once. My Articles

            A Offline
            A Offline
            ansriharsha
            wrote on last edited by
            #5

            hi, actually i want to fix the max length of numric part and the decimal part. thanks and regards, sriharsha

            1 Reply Last reply
            0
            • S Sun Rays

              Hi, you want the same ? string strD= 1000.1234; int dI =strD.indexof("."); string DecimalVal=strD.substring(dI,dI+1); string strVal=strD.substring(0,dI); Hope it will help you.. :-O

              Thanks, Sun Rays To get something you must have to try once. My Articles

              A Offline
              A Offline
              ansriharsha
              wrote on last edited by
              #6

              Hi , I used Regularexpression and its working fine. as: ; in controltovalidate : speicfy the textbox to validate ValidationExpression: which validates the expression in the format (8,2) otherwise gives error. Thanks for all suggestions. sriharsha

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups