0

I have one razor Input Text which will accept only numbers but with 3 decimal places but when i am trying to enter decimal after any number, it is deleting the decimal. following is the code for my input

    @Html.TextBoxFor(Function(Model) Model.ManifestDetail(0).md_weight, 
              New With {Key .[class] = "text-control text-right", 
              .[required] = "required", 
              .[maxlength] = "30", 
              .[Style] = "width:90px", 
              .[type] = "number", 
              .[min] = "0", 
              .[Step] = "0.001"})

Kindly help me if i am making any mistake.

Peter Smith
  • 5,528
  • 8
  • 51
  • 77
MAK
  • 161
  • 1
  • 13
  • Perhaps post the rendered HTML - is this even an ASP question or only an HTML issue? – mplungjan May 03 '20 at 08:50
  • i think it is HTML issue – MAK May 03 '20 at 08:54
  • So please post HTML and we will look at it – mplungjan May 03 '20 at 08:55
  • Sorry but what do u mean by post HTML? above is the code for my Input for model. I just need it to work properly as accepting 3 decimal places after any number. – MAK May 03 '20 at 08:57
  • If it renders like `` then it works for me. It is not possible for me to guess what your model renders since I know HTML and JS, not ASP – mplungjan May 03 '20 at 08:57
  • above code works for me also, if i simply take input type="number" but i need to attach it to the model property. – MAK May 03 '20 at 08:58
  • anybody who knows asp.net mvc as well as HTML kindly help me in this issue – MAK May 03 '20 at 08:59
  • Check the rendered HTML against [this](https://stackoverflow.com/questions/34057595/allow-2-decimal-places-in-input-type-number/34057860). Also `step` rather than`Step` perhaps, – Peter Smith May 03 '20 at 09:25
  • 1
    If you want FAST help, kindly do what we ask. If there is an issue with the HTML that is rendered, it will show if you could kindly post the rendered HTML instead of insisting on ASP help... But of course that is up to you.... If it is an ASP model problem, then I hope someone else can help – mplungjan May 03 '20 at 09:29
  • it has been resolved – MAK May 03 '20 at 11:50
  • Do you want to tell us how. Please share. – Peter Smith May 03 '20 at 11:56
  • Actually i have JavaScript written for converting entered text to uppercase. whenever i was typing anything other than number it was trying to convert to uppercase and it was deleting the point ".". so what i did i put the condition in the uppercase function to only convert the text to uppercase if entered text is alphabets. so now it is working fine with the same command i wrote above. – MAK May 04 '20 at 06:05

0 Answers0