[CLOSED] How to prevent sending viewstate / postdata to server on AjaxEvent?

  1. #1

    [CLOSED] How to prevent sending viewstate / postdata to server on AjaxEvent?

    Is there a way to prevent sending ViewState / PostData to the server during an AjaxEvent? I tried setting AjaxEvent.Type to 'Load' but it seems to be still sending them via url query string. Is it possible to set that property globally? Also, I have a grid with a server side OnRefreshData method. How do I configure AjaxEvent.Type for it? I tried Store.AjaxPostbackConfig.Type="Load" but it threw a javascript error. Thanks!

    Line: 10
    Error: The system cannot locate the resource specified.
  2. #2

    RE: [CLOSED] How to prevent sending viewstate / postdata to server on AjaxEvent?

    Hi jchau,

    I setted Type="Load" for the Store and I don't see ViewState in request. Params of my request
    _dc    1226570883064
    submitAjaxEventConfig    {"config":{"__EVENTTARGET":"ScriptManager1","__EVENTARGUMENT":"Store1|postback|refresh","extraParams":{"start":20,"limit":10}}}
    Are you sure that ViewState exists in your request?

    About error... I am pretty sure that problem related with invalid url. Did you set Url in AjaxPostbackConfig?

    If problems still occur then please post simple example which shows the problems

    Hope this help


  3. #3

    RE: [CLOSED] How to prevent sending viewstate / postdata to server on AjaxEvent?

    Hi jchau,

    Any update re: this ViewState/Load issue? Do you require any further assistence isolating the problem?


    Geoffrey McGill
    Founder
  4. #4

    RE: [CLOSED] How to prevent sending viewstate / postdata to server on AjaxEvent?

    I verified that Type="Load" is indeed working for AjaxEvents. I must have been doing something wrong before. I still have a question about store.reload(). Here's a sample grid where on button click, it reloads the grid. How do I get that reload to not pass viewstate and postdata? Also, is there a way to set Type="Load" globally like ViewStateMode?

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Grid.aspx.vb" Inherits="CooliteSandbox.Grid" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!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></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <script runat="server">
            Private Sub store_RefreshData(ByVal sender As Object, ByVal e As Coolite.Ext.Web.StoreRefreshDataEventArgs) Handles store.RefreshData
                Me.store.DataSource = EmployeeFactory.GetEmployees
                Me.store.DataBind()
            End Sub
        </script>
        <ext:ScriptManager ID="ScriptManager1" Theme="Gray" runat="server">
        </ext:ScriptManager>
        <ext:Store ID="store" runat="server">
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="LastName">
                        </ext:RecordField>
                        <ext:RecordField Name="FirstName">
                        </ext:RecordField>
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        <ext:ViewPort ID="ViewPort1" runat="server">
            <Body>
                <ext:FitLayout ID="FitLayout1" runat="server">
                    <ext:GridPanel runat="server" ID="grid" StoreID="store">
                        <ColumnModel ID="ColumnModel1" runat="server">
                            <Columns>
                                <ext:RowNumbererColumn Fixed="true">
                                </ext:RowNumbererColumn>
                                <ext:Column DataIndex="LastName" Header="Last Name">
                                </ext:Column>
                                <ext:Column DataIndex="FirstName" Header="First Name">
                                </ext:Column>
                            </Columns>
                        </ColumnModel>
                        <SelectionModel>
                            <ext:CheckboxSelectionModel runat="server">
                            </ext:CheckboxSelectionModel>
                        </SelectionModel>
                        <LoadMask ShowMask="true" />
                        <View>
                            <ext:GridView ForceFit="true">
                            </ext:GridView>
                        </View>
                        <Buttons>
                            <ext:Button runat="server" ID="btnLoad" Text="Reload">
                                <Listeners>
                                    <Click Handler="#{store}.reload()" />
                                </Listeners>
                            </ext:Button>
                        </Buttons>
                    </ext:GridPanel>
                </ext:FitLayout>
            </Body>
        </ext:ViewPort>
        </form>
    </body>
    </html>
  5. #5

    RE: [CLOSED] How to prevent sending viewstate / postdata to server on AjaxEvent?

    Hi jchau,

    You can set Type=Load for store requests
                <AjaxEventConfig Type="Load">                
                </AjaxEventConfig>
    For now it is no way to set Type="Load" for all requests by default.
    I think upcoming AjaxMethods can be real alternative because it used Type="Load"
  6. #6

    RE: [CLOSED] How to prevent sending viewstate / postdata to server on AjaxEvent?

    Thanks! That worked.

Similar Threads

  1. [CLOSED] server validation, datagrid, prevent row change?
    By seanwo in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 29, 2010, 1:07 PM
  2. Writing to ViewState within AjaxEvent
    By Lythius in forum 1.x Help
    Replies: 3
    Last Post: Oct 28, 2009, 3:36 PM
  3. Sending Store Data To Server
    By kumarxlnt in forum 1.x Help
    Replies: 0
    Last Post: Oct 27, 2009, 2:02 AM
  4. coolite label server value ajaxevent
    By tonymayoral in forum 1.x Help
    Replies: 2
    Last Post: Jul 26, 2009, 3:56 PM
  5. [CLOSED] ViewState when using AjaxEvent
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Mar 05, 2009, 9:30 AM

Posting Permissions