質問

I have a DotNetNuke site for logging hours worked by employees. I develop on my local machine using IIS Express and Visual Studio 2012.

I have an asp:GridView with several columns, one of which is an "asp:BoundField". In that column I display a date.

For years this has worked flawlessly, but all of a sudden my dates are being formatted as MM-dd-yyyy instead of MM/dd/yyyy. On the production site, which uses full IIS, the dates are still formatted correctly.

I have not made any changes to the web.config, other than to mess with the culture settings to try to fix this.

Since this is IIS Express, not IIS, I'm unsure if there is anything like globalization settings or a configuration I could change. I strongly suspect this is one of those "culture" issues I've heard about.

Markup for the asp:BoundField containing the date:

<asp:BoundField DataField="DateWorked" HeaderText="Date" SortExpression="Date" DataFormatString="{0:MM/dd/yyyy}"
    HtmlEncode="False">
    <ItemStyle HorizontalAlign="Center" />
    <HeaderStyle Wrap="False" CssClass="DataGrid_Header" />
</asp:BoundField>

web.config "globalization " tag:

<globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8"/>

I am unsure what to try next. Any help would be GREATLY appreciated at this point.

Thanks for reading,

-AS7K

役に立ちましたか?

解決

Found an answer here: ASP.NET Application is displaying american date formats

You can use code to detect and set the language in your application, in the global.aspx "Application_BeginRequest" method.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top