formatting a date field in a datagrid colum - newbie

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default formatting a date field in a datagrid colum - newbie

    I'm working with a datagrid control and needing to format a date field(from
    access) so that it just has dd/mm. Do I format it in the Tag or in my
    OnItemDataBoundEventHandler (or similar). I was looking at the
    DataFormatString parameter but couldn't get that to affect the data.
    Thanks
    Rich


    RP Guest

  2. Similar Questions and Discussions

    1. Date Field in OLAP datagrid
      Anyone know how to format a date field in the OLAP datagrid?
    2. Formatting Date in Column of DataGrid
      Hi guys, I have a WebServiceConnector component which is bound to a DataSet component, which is in turn bound to a DataGrid component. All is...
    3. Formatting a MySQL date field
      Hi, Andrew Banks wrote: See the PHP manual for the strtotime() and ( date() or strftime() ) functions. Or see the MySQL manual for date...
    4. formatting date on datagrid to get rid of time
      Hmm, how does the label work with the DataGrid? Anyway, what does the label look like, if not associated with the DataGrid? Will it display the date...
    5. DataGrid Field Formatting Question
      I want the contents of a textbox to be ALL CAPS when added to the database. How do I do that? And on the flip side - if I have existing data,...
  3. #2

    Default RE: formatting a date field in a datagrid colum - newbie

    You could have more control over the formatting by using the standard
    DateTime format strings in the OnItemDataBound event handler. See
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm[/url]
    l/cpconstandarddatetimeformatstringsoutputexample.as p for info about
    formatting date strings.

    Hope this helps,
    bliz

    --
    Jim Blizzard
    Sr .NET Developer Evangelist
    Microsoft

    Your Potential. Our Passion.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Please reply to newsgroups only, so that others may benefit. Thanks.


    --------------------
    >From: "RP" <explore65@yahoo.com>
    >Newsgroups: microsoft.public.dotnet.framework.aspnet
    >Subject: formatting a date field in a datagrid colum - newbie
    >Lines: 8
    >X-Priority: 3
    >X-MSMail-Priority: Normal
    >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    >Message-ID: <urHMa.22177$C83.2107607@newsread1.prod.itd.earthl ink.net>
    >Date: Wed, 02 Jul 2003 20:40:58 GMT
    >NNTP-Posting-Host: 24.221.218.192
    >X-Complaints-To: [email]abuse@earthlink.net[/email]
    >X-Trace: newsread1.prod.itd.earthlink.net 1057178458 24.221.218.192 (Wed,
    02 Jul 2003 13:40:58 PDT)
    >NNTP-Posting-Date: Wed, 02 Jul 2003 13:40:58 PDT
    >Organization: EarthLink Inc. -- [url]http://www.EarthLink.net[/url]
    >Path:
    cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
    e.de!nntp-relay.ihug.net!ihug.co.nz!news-hog.berkeley.edu!ucberkeley!newshub
    .sdsu.edu!elnk-pas-nf2!newsfeed.earthlink.net!stamper.news.pas.earthl ink.net
    !newsread1.prod.itd.earthlink.net.POSTED!not-for-mail
    >Xref: cpmsftngxa09.phx.gbl microsoft.public.dotnet.framework.aspnet:31844
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    >
    >I'm working with a datagrid control and needing to format a date field(from
    >access) so that it just has dd/mm. Do I format it in the Tag or in my
    >OnItemDataBoundEventHandler (or similar). I was looking at the
    >DataFormatString parameter but couldn't get that to affect the data.
    >Thanks
    >Rich
    >
    >
    >
    Jim Blizzard [MSFT] Guest

  4. #3

    Default formatting a date field in a datagrid colum - newbie

    You can set the format using the 'Data Formatting
    Expression:' field in the property builder for the column:
    {0:dd/mm}
    email if you need more...
    >-----Original Message-----
    >I'm working with a datagrid control and needing to format
    a date field(from
    >access) so that it just has dd/mm. Do I format it in
    the Tag or in my
    >OnItemDataBoundEventHandler (or similar). I was looking
    at the
    >DataFormatString parameter but couldn't get that to
    affect the data.
    >Thanks
    >Rich
    >
    >
    >.
    >
    David Waz... Guest

  5. #4

    Default Re: formatting a date field in a datagrid colum - newbie

    Thanks. I used the {0:dd/mm/yy} string in the property builder.

    Have a great 4th weekend.

    Rich


    RP Guest

  6. #5

    Default Re: formatting a date field in a datagrid colum - newbie

    Thanks. I used the {0:dd/mm/yy} string in the property builder.

    Have a great 4th weekend.

    Rich


    RP Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139