Getting "Could not cast or convert from System.String to System.DateTime" Exception if DataField is not entered from the user interface in Editable Grid

  1. #1

    Getting "Could not cast or convert from System.String to System.DateTime" Exception if DataField is not entered from the user interface in Editable Grid

    I have a store defined as follows :

    <ext:Store ID="storeRetailers" runat="server" OnBeforeStoreChanged="storeRetailers_BeforeChange">
            <Reader>
                <ext:JsonReader ReaderID="RetailerId">
                    <Fields>
                        <ext:RecordField Name="RetailerId" />
                        <ext:RecordField Name="EngagedDate" Type="Date" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
    In the editable grid column config is as follows:
    <ext:Column DataIndex="EngagedDate" Header="Engagement Date">
                                                    <Renderer Format="Date" FormatArgs="'d/m/Y'" />
                                                    <Editor>
                                                       <ext:DateField ID="txtEngagedDate" runat="server" AllowBlank="true" MsgTarget="Under" Format="dd/MM/yyyy"/>
                                                    </Editor>
                                                </ext:Column>
    But while saving the grid data, I am getting following exception If EngagementDate is not supplied from user interface.

    Could not cast or convert from System.String to System.DateTime.

    protected void contactStore_BeforeChange(object sender, BeforeStoreChangedEventArgs e)
        {
            ChangeRecords<ContactVO> data = e.DataHandler.ObjectData<ContactVO>(); // <-- Exception
    
        }
    Can you please give me some clue to resolve this ?
  2. #2

    RE: Getting "Could not cast or convert from System.String to System.DateTime" Exception if DataField is not entered from the user interface in Editable Grid

    Hi,

    It is fixed already. The fix will be available in 0.8.2 release
  3. #3

    RE: Getting "Could not cast or convert from System.String to System.DateTime" Exception if DataField is not entered from the user interface in Editable Grid

    Thanks for the update.

    BTW when 0.8.2 is coming ...?

Similar Threads

  1. Replies: 4
    Last Post: Feb 06, 2012, 8:51 AM
  2. Replies: 4
    Last Post: Feb 01, 2011, 11:54 AM
  3. Replies: 0
    Last Post: Dec 27, 2009, 1:47 PM
  4. Replies: 0
    Last Post: Sep 05, 2009, 8:52 AM
  5. System Security Exception
    By jaydwire2 in forum 1.x Help
    Replies: 0
    Last Post: Jul 31, 2009, 3:38 PM

Posting Permissions