Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > gridview.boundfield.dataformatstring doesn't work

Reply
Thread Tools

gridview.boundfield.dataformatstring doesn't work

 
 
Abraham Andres Luna
Guest
Posts: n/a
 
      11-30-2005
i tried the following code:

<asp:gridview id="gvRDK" runat="server" autogeneratecolumns="false">
<columns>
<asp:Boundfield DataField="DateCreate" DataFormatString="DateCreate:
{0:d}" HeaderText="Date Created:" />
</columns>
</asp:gridview>

but i got the following output:

Date Created:
DateCreate: 1/1/1900 12:00:00 AM


why isn't it formatting as a short date?

i then tried to following code:

<asp:datagrid id="dgRDK" runat="server" autogeneratecolumns="false">
<columns>
<asp:Boundcolumn DataField="DateCreate" DataFormatString="DateCreate:
{0:d}" HeaderText="BoundColumn" />
</columns>
</asp:datagrid>


and got the expected output:
BoundColumn
DateCreate: 1/1/1900


thank you for your help


 
Reply With Quote
 
 
 
 
Ing. Winkler Bernhard
Guest
Posts: n/a
 
      12-02-2005
Hi Abraham,

And here comes the solution:
http://msdn2.microsoft.com/en-us/lib...matstring.aspx

Add HtmlEncode="false" to the BoundField and all will work fine.


Bernhard Winkler


On Wed, 30 Nov 2005 14:14:46 -0500, "Abraham Andres Luna"
<(E-Mail Removed)> wrote:

>i tried the following code:
>
><asp:gridview id="gvRDK" runat="server" autogeneratecolumns="false">
> <columns>
> <asp:Boundfield DataField="DateCreate" DataFormatString="DateCreate:
>{0:d}" HeaderText="Date Created:" />
> </columns>
></asp:gridview>
>
>but i got the following output:
>
> Date Created:
> DateCreate: 1/1/1900 12:00:00 AM
>
>
>why isn't it formatting as a short date?
>
>i then tried to following code:
>
><asp:datagrid id="dgRDK" runat="server" autogeneratecolumns="false">
> <columns>
> <asp:Boundcolumn DataField="DateCreate" DataFormatString="DateCreate:
>{0:d}" HeaderText="BoundColumn" />
> </columns>
></asp:datagrid>
>
>
>and got the expected output:
> BoundColumn
> DateCreate: 1/1/1900
>
>
>thank you for your help
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE;Kontki if you delete kontiki any program you loaded with it in it 'will not work I have tried it with three programs and none work anymore (if you se it just stop download) 1-Twitch Computer Support 5 04-23-2009 02:45 PM
MS work around on text wrapping in a datagrid does not work TB ASP .Net 2 02-22-2006 10:34 PM
Hi I am new to asp i can not get it to work on xp pro sp2 even though the localhost work but asp pages dont so can some one help craig dicker ASP .Net 9 07-07-2005 11:52 AM
Re: Those cute little "WORK-SAFE" / "NOT WORK-SAFE" tags that people put in the Subject headers of their posts... Soapy Digital Photography 1 08-16-2004 12:07 PM
Re: Those cute little "WORK-SAFE" / "NOT WORK-SAFE" tags that people put in the Subject headers of their posts... Soapy Digital Photography 1 08-16-2004 06:24 AM



Advertisments