Saving To An ObjectDataSource

  1. #1

    Saving To An ObjectDataSource

    Hello again,
    I have a ObjectDataSource, which gets connected to a Store into a form. When I try to save the form data, I am getting following error:

    <style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style>System.Exception: Could not find a property named 'RequestsReader' on the type 
    specified by the DataObjectTypeName property in ObjectDataSource 'TRDataSource'. 
    ---> System.InvalidOperationException: Could not find a property named 
    'RequestsReader' on the type specified by the DataObjectTypeName property in 
    ObjectDataSource 'TRDataSource'. at 
    System.Web.UI.WebControls.ObjectDataSourceView.BuildDataObject(Type 
    dataObjectType, IDictionary inputParameters) at 
    System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary keys, 
    IDictionary values, IDictionary oldValues) at 
    System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, 
    IDictionary oldValues, DataSourceViewOperationCallback callback) at 
    Coolite.Ext.Web.Store.MakeUpdates(IDataSource ds, XmlDocument xml) at 
    Coolite.Ext.Web.Store.MakeChanges() at Coolite.Ext.Web.Store.DoSaving(String 
    jsonData, XmlNode callbackParameters) --- End of inner exception stack trace --- 
    at Coolite.Ext.Web.Store.DoSaving(String jsonData, XmlNode callbackParameters) 
    at Coolite.Ext.Web.Store.RaiseAjaxPostBackEvent(String eventArgument)
    Here's how the code would look like:
        <asp:ObjectDataSource ID="TRDataSource" runat="server"
            DataObjectTypeName="MyFramework.DataClasses.TroubleReportsData" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
            TypeName="MyFramework.DataSources.TroubleReportsDataSource" 
            DeleteMethod="DeleteItem" InsertMethod="InsertItem" 
            UpdateMethod="UpdateItem" 
            onselecting="TRDataSource_Selecting" onupdating="TRDataSource_Updating">
            <SelectParameters>
                <asp:Parameter Name="criteria" Type="Object" />
            </SelectParameters>
        </asp:ObjectDataSource>
    
    
        <ext:store runat="server" ID="CooliteStoreRequests" DataSourceID="TRDataSource" 
            GroupOnSort="True" AutoDataBind="true" >
            <Reader>
                <ext:JsonReader ReaderID="RequestsReader" runat="server">
                    <Fields>
                        <ext:RecordField Name="TRID"/>
                        <ext:RecordField Name="System"/>
                        <ext:RecordField Name="DescriptionSummary"/>
                        <ext:RecordField Name="Priority"/>
                        <ext:RecordField Name="DateSubmitted"/>
                        <ext:RecordField Name="Submitter"/>
                        <ext:RecordField Name="Phase"/>
                        <ext:RecordField Name="Description"/>
                        <ext:RecordField Name="AssignedTo"/>
                    </Fields>
                </ext:JsonReader>
            </Reader>        
            <Listeners>
                <load handler=#{TRForm}.loadData(this.getAt(0));" />
            </Listeners>
        </ext:store>    
    
                        <ext:FormPanel FormID="TRForm" ID="TRPanel" runat="server" Title="TR Details"
                            Width="300" StoreID="CooliteStoreRequests">
    
                            <Body>
                                <ext:formlayout runat="server" StoreID="CooliteStoreRequests" ID="FormLayOutTR" labelAlign="left">
                                    <ext:Anchor><ext:TextField runat="server" FieldLabel="TRID" ID="txtTRID" DataIndex="TRID" Disabled="true" Cls="x-item-disabled"/></ext:Anchor>
                                    <ext:Anchor Horizontal="98%"><ext:TextField runat="server" FieldLabel="System" DataIndex="System" ID="txtSystem"/></ext:Anchor>
                                    <ext:Anchor Horizontal="98%"><ext:TextField runat="server" FieldLabel="Description Summary" DataIndex="DescriptionSummary" ID="txtDescriptionSummary"/></ext:Anchor>
                                    <ext:Anchor Horizontal="98%"><ext:TextField runat="server" FieldLabel="Priority" DataIndex="Priority" ID="txtPriority"/></ext:Anchor>
                                    <ext:Anchor Horizontal="98%"><ext:TextField runat="server" FieldLabel="Submitter" DataIndex="Submitter" ID="txtSubmitter"/></ext:Anchor>
                                </ext:formlayout>
                            </Body>                   
                            <Buttons>
                                <ext:Button runat="server" Text="Save">
                                    <Listeners>
                                        <Click Handler='function()
                                                        {
                                                                #{TroubleReportsPanel}.getForm().updateRecord(#{CooliteStoreRequests}.getAt(0));
                                                                #{CooliteStoreRequests}.save();
                                                            }
                                                        
                                                        }' />
                                    </Listeners>
                                </ext:Button>                            
                            </Buttons>                          
                        </ext:FormPanel>
    I have tested the ObjectDataSource with .Net and it does save/update proper with ASP.Net version.

    Any idea how to get the save to work? It seems like when the store is trying to save the data into ObjectDataSource, it's getting rejected.

    Thanks

  2. #2

    RE: Saving To An ObjectDataSource

    Hi,

    Does 'MyFramework.DataSources.TroubleReportsDataSource' type contains property with name 'RequestsReader'?


    Please note that ReaderID is existing field name which should be interprete as id field


    Try to remove RedeaderID
  3. #3

    RE: Saving To An ObjectDataSource

    Great! That solved the issue!

    Thank you!

Similar Threads

  1. calendarpanel + objectdatasource
    By bossun in forum 1.x Help
    Replies: 3
    Last Post: Aug 08, 2012, 6:07 AM
  2. Replies: 2
    Last Post: Apr 14, 2011, 9:03 AM
  3. Can I use a Form with an ObjectDataSource?
    By FlorMariaF in forum 1.x Help
    Replies: 0
    Last Post: Jan 19, 2010, 1:46 PM
  4. Problems with asp:ObjectDataSource
    By jpbelli in forum 1.x Help
    Replies: 5
    Last Post: Feb 02, 2009, 1:34 PM
  5. GridPanel + ObjectDataSource
    By Chelonian in forum 1.x Help
    Replies: 2
    Last Post: Sep 05, 2008, 7:18 AM

Posting Permissions