Formating a date field in ASP .Net 2.0 detailview

Discussion in 'ASP .Net' started by =?Utf-8?B?Sm9obiBCYWlsZXk=?=, Mar 29, 2006.

  1. Okay, I am using a detail view to display some data. Two of the fields are
    date fields. I can't seem to get them to display properly. I have tried a
    variety of options in the DataFormatString property for the columns in
    question, but nothing is working. Is there a particular trick to this?
    =?Utf-8?B?Sm9obiBCYWlsZXk=?=, Mar 29, 2006
    #1
    1. Advertising

  2. "When the HtmlEncode property is true, the value of the field is HTML encoded
    to its string representation before the formatting string is applied. For
    some objects, such as dates, you might want to control how the object is
    displayed with a formatting string. In those cases, you must set the
    HtmlEncode property to false."

    http://msdn2.microsoft.com/en-us/li...trols.boundfield.dataformatstring(VS.80).aspx

    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "John Bailey" wrote:

    > Okay, I am using a detail view to display some data. Two of the fields are
    > date fields. I can't seem to get them to display properly. I have tried a
    > variety of options in the DataFormatString property for the columns in
    > question, but nothing is working. Is there a particular trick to this?
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Mar 29, 2006
    #2
    1. Advertising

  3. If you are using an SQL data source you can also control how the data is
    formatted using the CAST and CONVERT funtions in the query it's self so no
    formatting is required in the control.

    "Phillip Williams" wrote:

    > "When the HtmlEncode property is true, the value of the field is HTML encoded
    > to its string representation before the formatting string is applied. For
    > some objects, such as dates, you might want to control how the object is
    > displayed with a formatting string. In those cases, you must set the
    > HtmlEncode property to false."
    >
    > http://msdn2.microsoft.com/en-us/li...trols.boundfield.dataformatstring(VS.80).aspx
    >
    > --
    > HTH,
    > Phillip Williams
    > http://www.societopia.net
    > http://www.webswapp.com
    >
    >
    > "John Bailey" wrote:
    >
    > > Okay, I am using a detail view to display some data. Two of the fields are
    > > date fields. I can't seem to get them to display properly. I have tried a
    > > variety of options in the DataFormatString property for the columns in
    > > question, but nothing is working. Is there a particular trick to this?
    =?Utf-8?B?Y2xpY2tvbg==?=, Mar 30, 2006
    #3
  4. =?Utf-8?B?Sm9obiBCYWlsZXk=?=

    elizas

    Joined:
    Jan 27, 2010
    Messages:
    27
    Location:
    India
    Formating the string before displaying in ASP.NET

    In Some cases while displaying a large number it will be nice if we can format the number to a more readable format
    Like : Reputation Point : 537456
    Can be more readable if we can write it as Reputation Point : 537,456
    ASP.NET provide features like String.Format(format,arg0) to format arguments into different forms.
    For above solution you can implement

    Response.Write(String.Format("{0:#,###}", 123456789));
    Which will print 123,456,789

    {0:#,###} → Known as the format string where “{ ,}”are compulsory to mentation.
    The first part before ':' represent the argument number & it will be an integer.
    The second part after ':' represent the format that you want your argument to be converted.
    elizas, Apr 29, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Carnahan

    Help on date formating

    John Carnahan, Nov 19, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    306
    Alvin Bruney
    Nov 19, 2003
  2. Russ
    Replies:
    2
    Views:
    281
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,185
    Michael Borgwardt
    May 30, 2004
  4. Luqman
    Replies:
    2
    Views:
    823
    Luqman
    Apr 9, 2007
  5. Plissskin
    Replies:
    1
    Views:
    2,102
    Milosz Skalecki [MCAD]
    Jan 19, 2008
Loading...

Share This Page