|
-
Oct 31st, 2002, 09:50 AM
#1
Thread Starter
Frenzied Member
format date in a datagrid [RESOLVED]
I'm populating a datagrid and one of the fields is a date. The date comes over with the time. Anyone out there tell me how I can get rid of the time in my datagrid..
happy halloween
eye
Last edited by EyeTalion; Nov 1st, 2002 at 08:54 AM.
-
Oct 31st, 2002, 10:33 AM
#2
Hyperactive Member
Under the assumption that your mapping up each field and have "AutoGenerateColumns" equal to False this will work with page language="vb":
Code:
<Columns>
<asp:TemplateColumn HeaderText="CreateDttm">
<ItemTemplate>
<%# Container.DataItem ( "CreateDttm" ).ToShortDateString() %>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
-
Oct 31st, 2002, 12:02 PM
#3
Thread Starter
Frenzied Member
I'm not using templateColumn, heres my code for the datagrid. It's the last two fields that need to be formatted.
<Columns>
<asp:BoundColumn DataField="BID_DATE" SortExpression="BID_DATE" HeaderText="DATE"></asp:BoundColumn>
<asp:BoundColumn DataField="BID_ID" SortExpression="BID_ID" HeaderText="BID"></asp:BoundColumn>
<asp:BoundColumn DataField="BID_SCHEDULE_DESC" SortExpression="BID_SCHEDULE_DESC" HeaderText="DESCRIPTION"></asp:BoundColumn>
<asp:BoundColumn DataField="BUYER_NAME" SortExpression="BUYER_NAME" HeaderText="BUYER"></asp:BoundColumn>
<asp:BoundColumn DataField="EXPR1" SortExpression="EXPR1" HeaderText="POST TO WEB"></asp:BoundColumn>
<asp:BoundColumn DataField="DISPLAY_START_DATE" SortExpression="DISPLAY_START_DATE" HeaderText="DISPLAY START DATE"></asp:BoundColumn>
<asp:BoundColumn DataField="DISPLAY_END_DATE" SortExpression="DISPLAY_END_DATE" HeaderText="DISPLAY END DATE"></asp:BoundColumn>
</Columns>
-
Oct 31st, 2002, 12:19 PM
#4
Hyperactive Member
Right, so change those last two columns to the template columns like this:
Code:
<asp:BoundColumn
DataField="DISPLAY_START_DATE"
SortExpression="DISPLAY_START_DATE"
HeaderText="DISPLAY START DATE"/>
<asp:BoundColumn
DataField="DISPLAY_END_DATE"
SortExpression="DISPLAY_END_DATE"
HeaderText="DISPLAY END DATE"/>
would look like:
Code:
<asp:TemplateColumn
SortExpression="DISPLAY_START_DATE"
HeaderText="DISPLAY START DATE">
<ItemTemplate>
<%# Container.DataItem ( "DISPLAY_START_DATE" ).ToShortDateString() %>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn
SortExpression="DISPLAY_END_DATE"
HeaderText="DISPLAY END DATE">
<ItemTemplate>
<%# Container.DataItem ( "DISPLAY_END_DATE" ).ToShortDateString() %>
</ItemTemplate>
</asp:TemplateColumn>
-
Nov 1st, 2002, 08:53 AM
#5
Thread Starter
Frenzied Member
thanks, PVB...worked like a charm..
eye
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|