ASP.NET and OleDb datasets.?

Discussion in 'Digital Media' started by Neil, Apr 16, 2008.

  1. Neil Guest

    Neil
    Hi I'm currently coding an ASP.NET website and I've included a DataGrid View to display the data in a table in my database. Now two of the fields are date and time. I used Access as my database and set the fields appropriately and from Access they are fine. However when I use the GridView the fields display the full Date with the full time like a regulat DateTime object. I can't combine the two into 1 field. is there someway to display only the date part for one and the time part for the other. The language I am using is C# btw. 10x
    Neil,
  2. gdodd10 Guest

    gdodd10
    Are you trying to get the Date into one column and the Time into another?
    If yes:

    Use the DataFormatString attribute in your BoundField.
    So for example,
    <asp:BoundField Datafield="DateCreated" HeaderText="Customer Since" DataFormatString="{0:MM/dd/yyyy}" >
    <HeaderStyle HorizontalAlign="Center" Wrap="true" />
    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Wrap="False" />
    </asp:BoundField>

    That would give you just the date.

Share This Page