Community discussion forum

DataGrid DATE process???

  • 1 year ago

    hai,
    i m using ASP.NET with C# (.net 2005, 2.0 framework)
    here i have a datagrid which contains 10 columns.
    the 4,5,8 column contains date in the format (7/23/2007 12:00:00 AM). i want to change those date in (23-Jul-2007). the major key point in this is....
    1. Fields are dynamic, so i cant fix in DATABOUNDCOLUMN
    2. The placement should be the same (i.e, 4,5,8 columns)
    3. The data are filled to datagrid from SQL Server.

    How to achieve it? help me...... - KARAN

     

  • 1 year ago

    If it's databound... 

    <%# Eval("MyDateFieldName", "{0:dd-MMM-yyyy}") %>

     OR in code-behind...

    string myFormattedDate = string.Format("{0:dd-MMM-yyyy}", MyField);

     

    Hope that helps you.

  • 1 year ago

    its not databound my friend!

  • 1 year ago

    Then use the second option I provided my friend!

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!