Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2004
    Posts
    196
    Thanks
    1
    Thanked 0 Times in 0 Posts

    ??DataFormatString?? (vb.net VWD2005Exp)

    I am having trouble formatting a date column.

    <pre><asp:GridView ID="mixdesignGridView" runat="server" AllowSorting="True"
    AutoGenerateColumns="False" CellPadding="4" DataKeyNames="JobName"
    DataSourceID="materialsAccessDataSource"
    EmptyDataText="There are no data records to display."
    ForeColor="#333333" GridLines="None">
    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
    <Columns>
    <asp:CommandField ShowEditButton="True" />
    <asp:BoundField DataField="JobNumber" HeaderText="JobNumber"
    ReadOnly="True" SortExpression="JobNumber" />
    <asp:BoundField DataField="JobName" HeaderText="JobName"
    ReadOnly="True" SortExpression="JobName" />
    <asp:BoundField DataField="Location" HeaderText="Location"
    ReadOnly="True" SortExpression="Location" />
    <asp:BoundField DataField="SubgrdDate" HeaderText="SubgrdDate"
    ReadOnly="True" SortExpression="SubgrdDate"
    <font color=red>DataFormatString="{0:d}"</font color=red> />
    <asp:CheckBoxField DataField="MDsent" HeaderText="MDsent"
    SortExpression="MDsent" />
    <asp:CheckBoxField DataField="MDrcvd" HeaderText="MDrcvd"
    SortExpression="MDrcvd" />
    <asp:BoundField DataField="MD_Out" HeaderText="MD_Out"
    ReadOnly="True" SortExpression="MD_Out" />
    <asp:BoundField DataField="JobPM" HeaderText="JobPM"
    ReadOnly="True" SortExpression="JobPM" />
    <asp:BoundField DataField="MDnotes" HeaderText="MDnotes"
    SortExpression="MDnotes" />
    </Columns>
    <RowStyle BackColor="#cccccc" />
    <EditRowStyle BackColor="#7C6F57" />
    <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True"
    ForeColor="#333333" />
    <PagerStyle BackColor="#666666" ForeColor="White"
    HorizontalAlign="Center" />
    <HeaderStyle BackColor="#000000" Font-Bold="True"
    ForeColor="White" />
    <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    </pre>

    Can someone tell me why the <font color=red>DataFormatString</font color=red> is not formatting my date field properly? The current format looks like this:
    <span style="background-color: #FFFF00; color: #000000; font-weight: bold">12/11/2006 12:00 AM</span hi>
    I only want to see the date portion.

    thanks,
    jackal

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ??DataFormatString?? (vb.net VWD2005Exp)

    See if this helps.

    Try using "MM/dd/yyyy" (or "dd/MM/yyyy" if you're on the Eastern side of the pond). (Note: The "M" is capital - lower case "m" is minute.)

  3. #3
    2 Star Lounger
    Join Date
    Jan 2004
    Posts
    196
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: ??DataFormatString?? (vb.net VWD2005Exp)

    Well here again, I have got the answer to my own question.

    I added HtmlEncode="False"

    This makes my date field work with any format within { }

    thanks,
    jackal

Posting Permissions

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