-2

I have a model properties which is of decimal type, I have an edit form. This form has textboxes which shows values ends with .0, i wanted to remove this.0 from it. How to do that.

 public Nullable<decimal> PhoneNumber { get; set; }
 public Nullable<int> MeetingPinLength { get; set; }
4
  • what if that value has like this 25.365 ?
    – Sampath
    Commented Nov 19, 2016 at 10:40
  • Possible duplicate of stackoverflow.com/questions/479706/…
    – Fourat
    Commented Nov 19, 2016 at 10:43
  • value will always be like 25365 not with decimal i cannot change edmx i need another option to do that
    – c.jack
    Commented Nov 19, 2016 at 10:48
  • Tha is actually mvc view editorfor
    – c.jack
    Commented Nov 19, 2016 at 11:27

1 Answer 1

0

Here is the solution

<script type="text/javascript">
    $(document).ready(function () {
        var aliasstart = document.getElementById('AliasStart').value; 
        document.getElementById('AliasStart').value = Math.floor(aliasstart);

        var aliasstart1 = document.getElementById('AliasStep').value;
        document.getElementById('AliasStep').value = Math.floor(aliasstart1);

        var aliasstart2 = document.getElementById('AliasEnd').value;
        document.getElementById('AliasEnd').value = Math.floor(aliasstart2);

        var aliasstart3 = document.getElementById('PhoneNumber').value;
        document.getElementById('PhoneNumber').value = Math.floor(aliasstart3);

        var aliasstart4 = document.getElementById('PhoneNumber').value;
        document.getElementById('PhoneNumber').value = Math.floor(aliasstart4);



    });
</script>

Not the answer you're looking for? Browse other questions tagged or ask your own question.