从HTML发送小数号,但作为MVC C#的整数,ASP NET

发布于 2025-02-06 16:32:22 字数 49 浏览 1 评论 0原文

我试图通过表格将小数号从HTML发送到C#,但是它被捕获为整数。有人知道为什么是吗?

I'm trying to send a decimal number from html to c# via a form, but it gets caught as an integer.does anyone know why that is?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

下雨或天晴 2025-02-13 16:32:23

没有所有细节,我将检查两件事:

  1. 该模型以使其与
  2. 检查是否考虑到文化相关的细节。在某些国家,将小数分开的点(。)不一样。一些文化使用逗号(,)将小数分开,因此,您将获得整数值,作为默认文化后备。

Without all the details, I would check two things:

  1. The model so that it matches
  2. Check to see if I'm taking into account Culture relevant details. In some countries the dot (.) that separates the decimals is not the same. Some cultures use comma (,) to separate decimals and thus, you'll get the integer value, as the default culture fallback.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文