[MVC] On refresh: The control with id 'DataStore' not found

  1. #1

    [MVC] On refresh: The control with id 'DataStore' not found

    I have a GridPanel that I am populating from a DataTable:

    @model System.Data.DataTable
    
    ...
    
    @Html.X().ResourceManager()
    
    @(Html.X().Viewport()
        .Items(viewportItems => {
        ....
        viewportItems.Add(Html.X().GridPanel()
            ...
            .Store(store => {
                store.Add(Html.X().Store()
                    .ID("DataStore")
                    .DataSource(this.Model)
                    .Model(model => {
                        model.Add(Html.X().Model()
                        .ID("DataModel")
                        .IDProperty("UserCode")
                        .Fields(fields => {...}));
                    }));
                );
            })
            ...
            .BottomBar(bottombar =>
            {
                bottombar.Add(Html.X().PagingToolbar());
            })
    })
    )
    When I press the "refresh table" button on the BottomBar's PagingToolbar (and in a few other cases), I get the HttpException "Error executing child request for handler 'Ext.Net.SelfRenderingPage'" with an inner exception "The control with ID 'DataStore' was not found".

    I've researched this online and found that it might be something about dynamically creating things... But I don't know what that means or how to do that (or if that's even the problem). Help?
  2. #2
    Under MVC, Refresh button cannot be used without defined proxy in the store (or ServerProxy), proxy should retrieve data from a controller
  3. #3
    I was going to just remove the refresh button, but I decided I'm going to try to get it to work.
    Last edited by KBorkiewicz; Dec 05, 2012 at 5:46 PM.
  4. #4
    I did this to get it working... However, everything is now incredibly slow. What should I do differently?

    View:
    store.Add(Html.X().Store()
        ...
        .Proxy(proxy => {
            proxy.Add(Html.X().AjaxProxy()
                .Url("/Home/GetDataForRefresh")
                .Reader(reader => {
                    reader.Add(Html.X().JsonReader()
                        .Root("data")
                        .TotalProperty("total"));
                    }));
         }));
    Controller:
    public DataTable GetDataForRefresh()
    {
        StoreResult r = new StoreResult();
        r.Data = DL.GetData();
        r.Total = table.Rows.Count;
    
        return r;
    }
    Last edited by KBorkiewicz; Dec 05, 2012 at 6:55 PM.
  5. #5
    Only just figured it out:

    .ServerProxy(Html.X().AjaxProxy().Url(Url.Action("GetDataForRefresh")))
  6. #6
    Sometimes when I click the refresh button, I get a "Request Failure" with "Status Code: 200, Status Text: OK".
    What am I doing wrong?

    View:
    .ServerProxy(Html.X().AjaxProxy().Url(Url.Action("GetData")))
    Controller:
    public ActionResult GetData()
    {
        DataTable dataTable = ...
        return this.Store(dataTable);
    }

Similar Threads

  1. The control with ID 'ctl04_AddDoc' not found
    By geraldf in forum 2.x Help
    Replies: 1
    Last Post: Aug 24, 2012, 2:45 PM
  2. [CLOSED] The control with ID 'ext-empty-store' not found
    By supera in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 31, 2012, 12:16 PM
  3. Replies: 2
    Last Post: Nov 02, 2011, 7:07 AM
  4. Replies: 0
    Last Post: Jan 01, 2010, 6:50 AM
  5. Replies: 1
    Last Post: Mar 14, 2008, 11:47 PM

Tags for this Thread

Posting Permissions