[CLOSED] Date FieldType Store problem

  1. #1

    [CLOSED] Date FieldType Store problem

    I'm using a database source for my grid in which dates are stored as String: "dd-MM-yyyy"
    I''m creating the store dynamic from the source and like to create a Data type field in the store for these particular fields.

    In this string the names of the fields are mentioned which need to become datefields in the store :

    string dateFields = "factuurdatum,periodevan,periodetm";
    Here I create the fields:

    private static void createFieldsStore(ref Store s, DataTable dt)
        {
            s.RemoveFields();
            foreach (DataColumn c in dt.Columns)
            {
                s.AddField(dateFields.IndexOf(c.ColumnName.ToLower()) == -1 // check the names of the fields who need to become datafields in the store
                               ? new RecordField(c.ColumnName, RecordFieldType.Auto)
                               : new RecordField(c.ColumnName, RecordFieldType.Date));
            }
        }
    All fields are created perfectly, with te exception of the 3 fields in the string. They're probably not recognized as a valid date and empty in the grid.
    Any idea how to solve this ? I need those as datefields in the store because i'm using datefilters

    Example dates are "01-03-2010" or "31-12-2009"

    Martin
    Last edited by geoffrey.mcgill; Sep 21, 2010 at 4:26 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please set a respective DateFormat property for RecordField. It is used for casting string to date.

    Example
    RecordField rf = new RecordField("fieldName", RecordFieldType.Date, "dd-MM-yy");

Similar Threads

  1. [CLOSED] Problem with Converter on Date RecordField
    By GLD in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 31, 2012, 1:44 PM
  2. How to fromat date in Store and Combobox
    By metallica87 in forum 1.x Help
    Replies: 1
    Last Post: Jun 03, 2011, 7:51 AM
  3. [CLOSED] Wrong Date Format on the store
    By ViDom in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 25, 2011, 9:56 PM
  4. Store Date DBNULL
    By simonmicheal in forum 1.x Help
    Replies: 0
    Last Post: Aug 06, 2009, 6:52 PM
  5. Replies: 0
    Last Post: Jul 07, 2009, 4:34 AM

Tags for this Thread

Posting Permissions