日历日期选择器日期格式更改 [英] Calendar date picker Date Format change
本文介绍了日历日期选择器日期格式更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何更改Ajax日历日期选择器日期格式取决于Internet Explorer语言选择.
请帮助
在此先感谢..
How to change Ajax Calendar date picker Date Format Depending on internet explorer language selecton.
Please Help
Thanks in advance..
推荐答案
void Application_BeginRequest(Object sender,EventArgs e)
{
System.Globalization.CultureInfo newCulture =(System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
newCulture.DateTimeFormat.ShortDatePattern ="MM/dd/yyyy";
newCulture.DateTimeFormat.DateSeparator ="/";
System.Threading.Thread.CurrentThread.CurrentCulture = newCulture;
}
试试这个Global.asax页面和
web.config页面.
< system.web>
< globalization culture ="zh-cn" uiculture ="zh-CN">
void Application_BeginRequest(Object sender, EventArgs e)
{
System.Globalization.CultureInfo newCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
newCulture.DateTimeFormat.ShortDatePattern = "MM/dd/yyyy";
newCulture.DateTimeFormat.DateSeparator = "/";
System.Threading.Thread.CurrentThread.CurrentCulture = newCulture;
}
Try this Global.asax page and
web.config page.
<system.web>
<globalization culture="en-US" uiculture="en-US">
更改格式:
Change the format:
<asp:TextBox runat="server" ID="Date1" autocomplete="off" /><br />
<ajaxToolkit:CalendarExtender ID="defaultCalendarExtender" runat="server" TargetControlID="Date1" Format="dd/MM/yyyy" />
^ ]
设置EnableScriptGlobalization属性,以便客户端脚本可以在浏览器中显示区域性特定的日期和时间.
http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.enablescriptglobalization.aspx[^]
set the EnableScriptGlobalization property so that client script can display a culture-specific date and time in the browser.
这篇关于日历日期选择器日期格式更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文