Store Data is not binding

  1. #1

    Store Data is not binding

    Hello,

    I am trying to refresh the grid panel after some say 1 minute. But the grid is not getting updated. After clicking on refresh icon the data gets visible. So can any one help me out of this.

    code :
    Begin:
    System.Threading.Thread.Sleep(4000);
        if (Cache["XYZ"] != null)
        {
            taskRunList = (List<TaskRunDetails>)Cache["WorkflowStatus"];
            Store1.DataSource = taskRunList;
            Store1.DataBind();
            Store1.LoadData(taskRunList);
        }
        if (Session["ABC"] != null || Cache["XYZ"] != null)
        {
            goto Begin;
        }
        Store1.LoadData(taskRunList);
    }
    Last edited by Daniil; Jul 20, 2011 at 4:53 PM. Reason: Please use [CODE] tags
  2. #2
    Hi,

    Please look at the example.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Store_RefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            Store store = (Store)sender;
            store.DataSource = new object[] 
                { 
                    new object[] { "test11", DateTime.Now.ToLongTimeString() },
                    new object[] { "test12", DateTime.Now.ToLongTimeString() },
                    new object[] { "test13", DateTime.Now.ToLongTimeString() }
                };
            store.DataBind();        
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
                <Store>
                    <ext:Store runat="server" AutoLoad="false" OnRefreshData="Store_RefreshData">
                        <Reader>
                            <ext:ArrayReader>
                                <Fields>
                                    <ext:RecordField Name="test1" />
                                    <ext:RecordField Name="test2" />
                                </Fields>
                            </ext:ArrayReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column Header="Test1" DataIndex="test1" />
                        <ext:Column Header="Test2" DataIndex="test2" />
                    </Columns>
                </ColumnModel>
            </ext:GridPanel>
            <ext:TaskManager runat="server" AutoRunDelay="0">
                <Tasks>
                    <ext:Task AutoRun="true" Interval="5000">
                        <Listeners>
                            <Update Handler="GridPanel1.getStore().reload();" />
                        </Listeners>
                    </ext:Task>
                </Tasks>
            </ext:TaskManager>
        </form>
    </body>
    </html>
  3. #3

    Store data is not refreshing

    Hello Danill,

    Thanks for your example. But in my grid panel store, the data is not refreshing. And also it is not calling the method "Store_RefreshData" after some interval.

    Is there any way to call explicitly the"Store_RefreshData" method from other method in code behind ?? or reload all grid panel including store.??

    Thanks,
    Rahul.
  4. #4
    I used
    GridPanel1.getStore().reload();
    to reload the store/grid.

    Please provide your test sample.
  5. #5

    Store data is not refreshing

    He Danill.

    I have spawn a thread for following method:

    Method1()
    {
    System.Threading.Thread.Sleep(5000);
    List<TaskRunDetails> taskRunList = new BusinessLogicLayer.MonitorTaskExecutionTrans().FetchTaskStatusInfo(batchId, repositoryId);
    new BusinessLogicLayer.ExecuteWorkFlowTrans().SaveBatchWorkflowsStatus(taskRunList, batchId);
    Store2.DataSource = taskRunList;
    Store2.LoadData(taskRunList);
    Store2.DataBind();
    }
    But the grid data is not changing. So, can you please help me out of this.

    Thanks,
    Rahul.
    Last edited by Daniil; Jul 27, 2011 at 9:23 AM. Reason: Please use [CODE] tags
  6. #6
    Well, I don't know how you use the "Method1".

    And why do you use .Sleep()?

    Also you should use only one of these method: .DataBind() and .LoadData().
  7. #7

    Store data is not refreshing

    Hello Daniil,

    I have created one thread and passed it to method1(). So that user can also navigate to other pages in meanwhile at the time of method1() executes. Because, method() is taking around 4-5 minutes for execution.

    I am using sleep(), so that, control will wait for some time and then again fetch the data from database(updated). And i want to show that updated data into the grid view.

    Thanks,
    Rahul.
  8. #8
    Please provide a full sample which we can run and test locally on our side.

Similar Threads

  1. [CLOSED] Data binding to NetTiers data entity objects
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 09, 2012, 3:35 PM
  2. Data Binding
    By Deepak in forum 1.x Help
    Replies: 3
    Last Post: Nov 04, 2010, 10:27 AM
  3. Replies: 10
    Last Post: Apr 15, 2010, 5:39 AM
  4. Replies: 3
    Last Post: Feb 25, 2010, 10:25 AM
  5. Replies: 8
    Last Post: Sep 06, 2008, 7:02 PM

Posting Permissions