[CLOSED] GridPanel with Store and dynamic ObjectDataSource

  1. #1

    [CLOSED] GridPanel with Store and dynamic ObjectDataSource

    I have a problem with a grid I am using. For objective reasons it is hard for me to post a full example as it is quite a complicated page but maybe someone can spot the issue from these hints:

    I have a customized control that contains a store and a grid. The store is made public via a property of the user control to allow for changes. Then in the containing page I create an ObjectDataSource on the fly:

                    ObjectDataSource ds = new ObjectDataSource("Truvo.Web.KWI.DB.SubPhrase", "ListFromText");
                    ds.SelectParameters.Add(new Parameter("Phrase", System.Data.DbType.String, Phrase));
                    ds.SelectParameters.Add(new Parameter("HeadingID", System.Data.DbType.Int32, Heading.ToString()));
                    ds.SelectParameters.Add(new Parameter("Locale", System.Data.DbType.String, Locale));
                    gridClassify.DataSource = ds;
                    gridClassify.DataBind();
    now, when debugging I can see everything goes fine and the ajax response looks great (this is the relevant part of it):

    ctl00_ContentPlaceHolder1_winKeywordSplit_gridClassify_ClassifyStore.callbackRefreshHandler(response, {serviceResponse: {Data:{data:[{\"ID\":1,\"Text\":\"restaurant\",\"HeadingId\":1480,\"Locale\":\"fr-BE\",\"BrandStatus\":0,\"BusinessNameStatus\":0,\"GenericStatus\":0,\"JunkStatus\":0,\"LocationNameStatus\":0,\"ProductStatus\":0,\"ServiceStatus\":0},{\"ID\":2,\"Text\":\"à\",\"HeadingId\":1480,\"Locale\":\"fr-BE\",\"BrandStatus\":0,\"BusinessNameStatus\":0,\"GenericStatus\":0,\"JunkStatus\":0,\"LocationNameStatus\":0,\"ProductStatus\":0,\"ServiceStatus\":0},{\"ID\":3,\"Text\":\"buffet\",\"HeadingId\":1480,\"Locale\":\"fr-BE\",\"BrandStatus\":0,\"BusinessNameStatus\":3,\"GenericStatus\":0,\"JunkStatus\":0,\"LocationNameStatus\":0,\"ProductStatus\":0,\"ServiceStatus\":0},{\"ID\":4,\"Text\":\"tout\",\"HeadingId\":1480,\"Locale\":\"fr-BE\",\"BrandStatus\":0,\"BusinessNameStatus\":0,\"GenericStatus\":0,\"JunkStatus\":0,\"LocationNameStatus\":0,\"ProductStatus\":0,\"ServiceStatus\":0},{\"ID\":5,\"Text\":\"compris\",\"HeadingId\":1480,\"Locale\":\"fr-BE\",\"BrandStatus\":0,\"BusinessNameStatus\":0,\"GenericStatus\":0,\"JunkStatus\":0,\"LocationNameStatus\":0,\"ProductStatus\":0,\"ServiceStatus\":0},{\"ID\":6,\"Text\":\"ouvert\",\"HeadingId\":1480,\"Locale\":\"fr-BE\",\"BrandStatus\":0,\"BusinessNameStatus\":0,\"GenericStatus\":0,\"JunkStatus\":0,\"LocationNameStatus\":0,\"ProductStatus\":0,\"ServiceStatus\":0},{\"ID\":7,\"Text\":\"le\",\"HeadingId\":1480,\"Locale\":\"fr-BE\",\"BrandStatus\":0,\"BusinessNameStatus\":0,\"GenericStatus\":0,\"JunkStatus\":0,\"LocationNameStatus\":0,\"ProductStatus\":0,\"ServiceStatus\":0},{\"ID\":8,\"Text\":\"dimanche\",\"HeadingId\":1480,\"Locale\":\"fr-BE\",\"BrandStatus\":0,\"BusinessNameStatus\":3,\"GenericStatus\":0,\"JunkStatus\":0,\"LocationNameStatus\":0,\"ProductStatus\":0,\"ServiceStatus\":0},{\"ID\":9,\"Text\":\"à\",\"HeadingId\":1480,\"Locale\":\"fr-BE\",\"BrandStatus\":0,\"BusinessNameStatus\":0,\"GenericStatus\":0,\"JunkStatus\":0,\"LocationNameStatus\":0,\"ProductStatus\":0,\"ServiceStatus\":0},{\"ID\":10,\"Text\":\"charleroi\",\"HeadingId\":1480,\"Locale\":\"fr-BE\",\"BrandStatus\":0,\"BusinessNameStatus\":0,\"GenericStatus\":0,\"JunkStatus\":0,\"LocationNameStatus\":0,\"ProductStatus\":0,\"ServiceStatus\":0}], totalCount: 0},Success:true}}, ctl00_ContentPlaceHolder1_winKeywordSplit_gridClassify_ClassifyStore, o.eventType, o.action, o.extraParams);
    but the grid does not contain any rows.
    what could be the problem?
    Last edited by Daniil; Dec 20, 2010 at 2:22 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Can you provide the Store configuration?
  3. #3
    Hi Vladimir,
    thanks for the reply. Here it is:

        <ext:Store ID="ClassifyStore" runat="server" AutoLoad="false" RemoteSort="false" ShowWarningOnFailure="true">
            <AjaxEventConfig IsUpload="true" />
            <Proxy>
                <ext:DataSourceProxy />
            </Proxy>
    
            <Reader>
                <ext:JsonReader ReaderID="ID">
                    <Fields>
                        <ext:RecordField Name="Text" />
                        <ext:RecordField Name="HeadingId" />
                        <ext:RecordField Name="HeadingCode" />
                        <ext:RecordField Name="HeadingName" />
                        <ext:RecordField Name="Locale" />
                        <ext:RecordField Name="WordCount" Type="Int" />
                        <ext:RecordField Name="SearchCount" Type="Int" />
                        <ext:RecordField Name="BrandStatus" Type="Int" />
                        <ext:RecordField Name="BusinessNameStatus" Type="Int" />
                        <ext:RecordField Name="GenericStatus" Type="Int" />
                        <ext:RecordField Name="JunkStatus" Type="Int" />
                        <ext:RecordField Name="LocationNameStatus" Type="Int" />
                        <ext:RecordField Name="ProductStatus" Type="Int" />
                        <ext:RecordField Name="ServiceStatus" Type="Int" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <Listeners>
                <Load Handler="currentClassificationStatus = new Object;" />
            </Listeners>
        </ext:Store>
    I am thinking about coding multiple ObjectDataSources inside the control and then based on a property pick which one to get data from. Because if I try with the following data source:

        <asp:ObjectDataSource ID="ClassifyDataSource" runat="server">
            <SelectParameters>
                <asp:Parameter Name="Phrase" />
                <asp:Parameter Name="HeadingCode" />
                <asp:Parameter Name="LocaleCode" />
                <asp:Parameter Name="Chunk" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
    it works (instead of a dynamic one)
  4. #4
    it worked,
    by specifying two data sources in the markup and then switch between them in the code behind.
  5. #5
    Hi alexp,

    Please note that ReaderID="ID" doesn't make sense because there is no RecordField with name "ID".
    <ext:JsonReader ReaderID="ID">
    ReaderID is
    Name of the property within a row object that contains a record identifier value.

Similar Threads

  1. Replies: 2
    Last Post: Apr 12, 2012, 5:44 AM
  2. Replies: 1
    Last Post: Dec 14, 2011, 8:17 PM
  3. Replies: 0
    Last Post: Mar 04, 2011, 12:05 PM
  4. Store update ObjectDataSource params mismatch
    By Neil_Walters in forum 1.x Help
    Replies: 2
    Last Post: Mar 14, 2010, 10:11 PM
  5. Clear Store binded to ObjectDataSource
    By juanpablo.belli@huddle.com.ar in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 02, 2009, 4:03 AM

Posting Permissions