I have a gridview on my form. I am binding it with same data. There is a template field, which I mentioned below.
<asp:TemplateField HeaderText="To">
<itemtemplate>
<asp:Label ID="Label2" runat="server"
Text='<%# Convert.ToDateTime(Eval("Leave_To")).ToString("dd/MM/yyyy") %>'></asp:Label>
</itemtemplate>
<headerstyle horizontalalign="Left" />
<itemstyle horizontalalign="Left" />
</asp:TemplateField>
My issue is that when I run this form on Mozilla, Opera, Chrome etc. it shows the date format (with oblique) dd/mm/yyyy
, but when I run it with ie 10 it shows format (with hyphen) dd-mm-yyyy
. why?
Can anyone help on this ?
I can't test it right now, but I guess the IE is sending a "Accept-Language" header in the request, that is different of your current culture. Thus, it is overriding the current culture of the application (Culture of the WebServer/IIS)...
Try to set this on your Web.config:
<configuration>
<system.web>
<globalization culture="en-GB" uiCulture="en-GB" />
</system.web>
</configuration>
Set your desired culture inside the principal key. (But the culture "en-GB" already provides the desired date format).
Hope I helped...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With