ViewState not working during OnRefreshData event

  1. #1

    ViewState not working during OnRefreshData event

    Hello,

    I'm trying to persist some data in the ViewState during the OnRefreshData event from the Store object.
    I've changed the ViewStateMode property of the store to Enabled and the EnabledViewState to true.

    Can somebody help to understand what is wrong?

    Here is the code

        protected void stItems_RefreshData(object source, EventArgs e)
        {
            if (X.IsAjaxRequest)
            {
                if (ViewState[kVS_Statistics] == null)
                    ViewState[kVS_Statistics] = GetKPI().Values;
    
                stItems.DataSource = (SortedDictionary<string, MonthLoad>.ValueCollection)ViewState[kVS_Statistics];
                stItems.DataBind();
            }
        }
    
    <ext:Store ID="stItems" runat="server" GroupField="Employee" AutoLoad="true" OnRefreshData="stItems_RefreshData" ViewStateMode="Enabled" EnableViewState="true">
                <Proxy>
                    <ext:PageProxy />
                </Proxy>
                <SortInfo Direction="DESC" Field="Period" />
                <Reader>
                    <ext:JsonReader IDProperty="ID">
                        <Fields>
                            <ext:RecordField Name="Employee" />
                            <ext:RecordField Name="Period" />
                            <ext:RecordField Name="EstimatedHours" Type="Float" />
                            <ext:RecordField Name="WorkedHours" Type="Float" />
                            <ext:RecordField Name="Performance" Type="Float" />
                            <ext:RecordField Name="BugsPreRelease" Type="Int" />
                            <ext:RecordField Name="BugsPostRelease" Type="Int" />
                            <ext:RecordField Name="SupportHours" Type="Float" />
                            <ext:RecordField Name="ProjectLoadSummary" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
    Thanks,
    Ariel
  2. #2

    Same Problem

    I'm in the same situation, i have the code below, butthe viewstate doesn't persist between refreshdata's:


    <ext:Store ID="_strTipoDeLogradouro" runat="server" AutoLoad="false" EnableViewState="true" OnRefreshData="_strTipoDeLogradouro_RefreshData">
            <Proxy>
                <ext:PageProxy />
            </Proxy>
            <AutoLoadParams>
                <ext:Parameter Name="inicio" Value="0" Mode="Raw" />
                <ext:Parameter Name="fim" Value="10" Mode="Raw" />
            </AutoLoadParams>
            <Reader>
                <ext:JsonReader IDProperty="ID">
                    <Fields>
                        <ext:RecordField Name="ID" Mapping="ID" Type="Int" />
                        <ext:RecordField Name="Nome" Mapping="Nome" Type="String" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <Listeners>
                <LoadException Handler="Ext.Msg.alert('Employees - Load failed', e.message || response.statusText);" />
            </Listeners>
        </ext:Store>
    Last edited by geoffrey.mcgill; Sep 28, 2010 at 5:18 PM. Reason: please use [CODE] tags
  3. #3
    Hi,

    Please add the following code to the store
    <DirectEventConfig ViewStateMode="Enabled" />
  4. #4
    Thanks, this works fine!
  5. #5
    How to establish the above using version 2.2?

Similar Threads

  1. [CLOSED] MultiCombo Change Event Not Saving ViewState
    By garrisrd in forum 1.x Legacy Premium Help
    Replies: 14
    Last Post: Nov 29, 2011, 8:26 PM
  2. Problem about store event "OnRefreshData"
    By zhangsir199 in forum 1.x Help
    Replies: 1
    Last Post: Jan 04, 2011, 9:33 AM
  3. Ajax Event not working
    By vickygajula in forum 1.x Help
    Replies: 3
    Last Post: Dec 09, 2010, 5:19 PM
  4. Replies: 1
    Last Post: May 19, 2010, 9:12 AM
  5. How to update viewstate in ajax event?
    By bruce in forum 1.x Help
    Replies: 1
    Last Post: Feb 08, 2009, 11:00 PM

Posting Permissions