Results 1 to 7 of 7

Thread: [2008] Details DataFormatString

Threaded View

  1. #1

    Thread Starter
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    [2008] Details DataFormatString

    I know Google lights up like a Christmas tree when you search for something regarding date format in ASP.NET but I'm still having a problem with a BoundField and formatting its date.

    ExpiryDate is varchar2(4000) in dd/mm/yyyy format.
    SQL (Oracle 9i):
    sql Code:
    1. select
    2.   ag.AGREEMENTS_ABBR LicensorNumber,
    3.   (select r1.FIELD_VALUE
    4.   from V_REPCUSTOMFIELDDATA r1
    5.   where
    6.     r1.INTERNAL_DESCRIPTIONS_CODE = 21
    7.     and r1.ASSOCIATED_WITH_CODE = ag.AGREEMENTS_ABBR) ContractName,
    8.   ag.AGREEMENTS_NAME ProjectName,
    9.   ag.AGREEMENTS_AVAILDATE AvailableDate,
    10.   to_date(ag.AGREEMENTS_EXPLEXPIRES, 'dd/mm/yyyy') ExpiryDate,
    11.   (select to_date(r2.FIELD_VALUE, 'dd-mon-yyyy')
    12.   from V_REPCUSTOMFIELDDATA r2
    13.   where
    14.     r2.INTERNAL_DESCRIPTIONS_CODE = 35
    15.     and r2.ASSOCIATED_WITH_CODE = ag.AGREEMENTS_ABBR) SellOffDate,
    16.   ag.FREQ_DISPLAY ReportFrequency
    17. from V_AGREEMENT ag
    18. where ag.AGREEMENTS_ABBR = :licensorNum

    DetailsView:
    Code:
            <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False">
                <Fields>
                    <asp:BoundField DataField="LicensorNumber" HeaderText="Licensor Number" />
                    <asp:BoundField DataField="ProjectName" HeaderText="Project Name" />
                    <asp:BoundField DataField="AvailableDate" 
                        DataFormatString="{0:MM/dd/yyyy}" HeaderText="Start Date" 
                        HtmlEncode="False" />
                    <asp:BoundField DataField="ExpiryDate" 
                        DataFormatString="{0:MM/dd/yyyy}" HeaderText="Expiry Date" 
                        HtmlEncode="False" />
                    <asp:BoundField DataField="SellOffDate" HeaderText="Sell Off Date" 
                        DataFormatString="{0:MM/dd/yyyy}" 
                        HtmlEncode="False" />
                    <asp:BoundField DataField="ReportFrequency" HeaderText="Reporting Frequency" />
                </Fields>
            </asp:DetailsView>
    SellOffDate (also a varchar2(4000)) appears formatted correctly in my DetailsView. ExpiryDate appears formatted as "12/31/99 12:00:00AM" in my Details View.

    What simple thing am I missing this time?

    EDIT: Please note that I cannot change the Data Types in the database.
    EDIT2: Nuts - meant to say DetailsView in the title, of course.
    Last edited by nmadd; Apr 22nd, 2008 at 01:58 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width