Jump to content

My Date Format Not Work


Helgeduelbeck

Recommended Posts

Guys,I'm still confuse, why my date format dnot work out ?It still return with the general date d/mm/yyyy hh:nn:ss AM/PM.My data source is come from .MDB and I call it and view by datagrid / gridview.Here's the snippet :<table border="0" cellpadding="0" cellspacing="0" style="width: 100%"> <tr ><td align="center" valign="top"><table border="0" cellpadding="0" cellspacing="0"> <tr ><td align="center" valign="top"><asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"DataSourceID="AccessDataSource1" CssClass="tb01" AutoGenerateColumns="False"><FooterStyle CssClass="tb01-ft" /><PagerStyle CssClass="tb01-ft" ForeColor="White" /><HeaderStyle CssClass="tb01-hd" Font-Size="Small" ForeColor="White" Wrap="True" /><Columns><asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /><asp:BoundField DataField="Code" HeaderText="Code" SortExpression="Code" /><asp:BoundField DataField="Start" DataFormatString="{0:d}" HeaderText="Start" SortExpression="Start" /><asp:BoundField DataField="Finish" DataFormatString="{0:d}" HeaderText="Finish" SortExpression="Finish" /><asp:BoundField DataField="Building" HeaderText="Building" SortExpression="Building" /></Columns></asp:GridView></td><td align="center" valign="bottom"><asp:Button ID="Button1" runat="server" Text="Close" PostBackUrl="java script:self.close()" /></td> </tr></table></td></tr></table><asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/general.mdb" SelectCommand="SELECT TBL_PROJECT.NAMEPROJECT AS Name, TBL_PROJECT.STARTPROJECT AS Start, TBL_PROJECT.ENDPROJECT AS Finish, TBL_PROJECT.JOBNO AS [Job No], TBL_PROJECT.CLIENT AS Client, TBL_PROJECT.BUILDING AS Building, TBL_PROJECT.CODEPROJECT AS Code, TBL_PROJECT.IDPROJECT AS IDPROJECTFROM TBL_PROJECT"></asp:AccessDataSource>The start and finish column still displaying the long date and time format !! I already put {0:d} right ?Or may be I missed something there ? :)

Link to comment
Share on other sites

Have you tried {0:dd/MM/yyyy} or {0:MM/dd/yyyy} as your DataFormatString?
Hi Jesh.I did it what you told me.. and still can't have a good result.I tried everything and ... you now what ?It solved when I try : <asp:BoundField DataField="Start" DataFormatString="{0:dd-MMM-yyyy}" HeaderText="Start" SortExpression="Start" HtmlEncode="False" ><ItemStyle Wrap="False" /></asp:BoundField>I don't the meaning of : HtmlEncode="False"And there are still another things I want but still have errors.I hope I did the right thing migrating to .NET : THERE'S A LOT OF DIFFERENCES FROM ASP !But thank you, Jesh .... for helped me. :)
Link to comment
Share on other sites

Have you tried {0:dd/MM/yyyy} or {0:MM/dd/yyyy} as your DataFormatString?
Hi Jesh.I did it what you told me.. and still can't have a good result.I tried everything and ... you now what ?It solved when I try : <asp:BoundField DataField="Start" DataFormatString="{0:dd-MMM-yyyy}" HeaderText="Start" SortExpression="Start" HtmlEncode="False" ><ItemStyle Wrap="False" /></asp:BoundField>I don't understand of the meaning of : HtmlEncode="False"And there are still another things I want but still have errors.I hope I did the right thing migrating to .NET : THERE'S A LOT OF DIFFERENCES FROM ASP !But thank you, Jesh .... for helped me. :)
Link to comment
Share on other sites

THERE'S A LOT OF DIFFERENCES FROM ASP !
thank goodness for that :) :)It can be a steep learning curve but once you've made it you will realize that .Net has so much more power and a much better languageHTML Encoding tells the interpreter whether to process the html charcters/tags it finds within the control or to just show them as text
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...