[CLOSED] Setting Store OnRefreshData in code behind

  1. #1

    [CLOSED] Setting Store OnRefreshData in code behind

    Hello,

    In previous posts I found this (server code):

    protected void Page_Load(object sender, EventArgs e)
        {
            Store store = new Store();
            store.RefreshData += new Store.AjaxRefreshDataEventHandler(store_RefreshData);
     
        }
     
        void store_RefreshData(object sender, StoreRefreshDataEventArgs e)
        {
             
        }

    But store has no RefreshData property at all!?


    Any idea?


    Thanks.
    Last edited by geoffrey.mcgill; Dec 06, 2010 at 4:17 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I'm not sure what you mean.

    Please look at the example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <script runat="server">
        
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Store1.RefreshData += Store_RefreshData;
        }
    
        public List<object> MyData = new List<object>
        { 
            new {test = "test1"},
            new {test = "test2"},
            new {test = "test3"},
            new {test = "test4"},
            new {test = "test5"},
            new {test = "test6"},
            new {test = "test7"},
            new {test = "test8"},
            new {test = "test9"}
        };
    
        protected void Store_RefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            List<object> data = this.MyData;
            var limit = e.Limit;
            if ((e.Start + e.Limit) > data.Count)
            {
                limit = data.Count - e.Start;
            }
            List<object> rangeData = (e.Start < 0 || limit < 0) ? data : data.GetRange(e.Start, limit);
            this.Store1.DataSource = rangeData;
            e.TotalCount = data.Count;
        }
    </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>Coolite 0.8.x Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ScriptManager runat="server" />
        <ext:Store ID="Store1" runat="server">
            <Proxy>
                <ext:DataSourceProxy TotalCount="9" />
            </Proxy>
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="test" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <BaseParams>
                <ext:Parameter Name="start" Value="0" Mode="Raw" />
                <ext:Parameter Name="limit" Value="3" Mode="Raw" />
            </BaseParams>
        </ext:Store>
        <ext:GridPanel runat="server" StoreID="Store1" AutoHeight="true">
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <BottomBar>
                <ext:PagingToolbar runat="server" PageSize="3" />
            </BottomBar>
        </ext:GridPanel>
        </form>
    </body>
    </html>
  3. #3

    I mean this...

    In code behind:

    Dim st as New Store

    st.RefreshData - Ther's no such property "RefreshData" to assign handler to!?
  4. #4
    Hmm... What exactly version do you use?
  5. #5
    I have checked this. The RefreshData exists either in Ext.Net 1.0 and 0.8.x.

    So, could you provide a full sample code to reproduce?
  6. #6
    Ok, the exact issue is that it DOES NOT EXIST in Vb.Net (IT DOES in C# though).


    So please investigate.


    BTW I am using 1.0.396xxx version.


    Thanks.
  7. #7
    With VB.NET it should look like this:

    Example
    Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim store As Ext.Net.Store = New Ext.Net.Store()
        AddHandler store.RefreshData, AddressOf Store1_RefreshData
    End Sub
    
    Protected Sub Store1_RefreshData(ByVal sender As Object, ByVal e As StoreRefreshDataEventArgs)
        'some code 
    End Sub
    See also
    http://msdn.microsoft.com/en-us/libr...=VS.90%29.aspx

Similar Threads

  1. Replies: 3
    Last Post: Jul 24, 2011, 1:57 PM
  2. Replies: 3
    Last Post: Jun 29, 2010, 7:31 PM
  3. [CLOSED] [1.0] Passing ExtraParams on Store OnRefreshData
    By state in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 01, 2010, 3:02 AM
  4. Store.OnRefreshData and SortInfo
    By Awrong in forum 1.x Help
    Replies: 1
    Last Post: Dec 30, 2009, 6:04 AM
  5. [CLOSED] Store OnRefreshData callback exectuted twice
    By jeremyl in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 09, 2009, 7:02 AM

Tags for this Thread

Posting Permissions