如何设置一个文本框的文本模式的价值=最新ASP.NET C# [英] How to set the value of a textbox textmode=date ASP.NET C#

查看:114
本文介绍了如何设置一个文本框的文本模式的价值=最新ASP.NET C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你能帮帮我。

我试图从设置变量的文本框的文本模式=日期。

I'm trying to set a textbox textmode=date from a variable.

是这样的:

txtDataDespesa.Text = d.DataDespesa.ToShortDateString();

问题是,当我去到可视化的页面, d.DataDespesa.ToShortDateString()在txtDataDespesa没有显示的价值,反而是默认值 DD / MM / YYYY

The problem is, when I go to visualize the page, the value of d.DataDespesa.ToShortDateString() isn't showing in the txtDataDespesa, instead is the default values dd/mm/yyyy

先谢谢了。

推荐答案

这无关与asp.net,但HTML5。当使用键入=日期你应该总是使用格式 YYYY-MM-DD W3C标准

This has nothing to do with asp.net, but Html5. When using type="date" you should always use the format yyyy-MM-dd (W3C standard)

问题是,在不支持类型=最新的浏览器,这将显示为二零一四年三月三十日,但对那些支持它的浏览器,它是根据在客户OS的区域设置显示。

The problem is that in browsers that don't support type=date, this will show up as 2014-03-30, but on browsers that do support it, it is displayed according to the regional settings in the client OS.

因此​​,它可能是 2014年3月30日 30.March.2014 MAR-30-2014 ,您对格式无法控制,用户。

So it may be 2014-03-30, 30.March.2014 or Mar-30-2014, you have no control over the format, the user has.

这篇关于如何设置一个文本框的文本模式的价值=最新ASP.NET C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆