View Full Version : [CLOSED] How to prevent sending viewstate / postdata to server on AjaxEvent?

Nov 12, 2008, 3:52 PM
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.

Nov 13, 2008, 6:12 AM
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

Nov 14, 2008, 4:41 AM
Hi jchau,

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

Nov 14, 2008, 12:57 PM
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">
<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
End Sub
<ext:ScriptManager ID="ScriptManager1" Theme="Gray" runat="server">
<ext:Store ID="store" runat="server">
<ext:RecordField Name="LastName">
<ext:RecordField Name="FirstName">
<ext:ViewPort ID="ViewPort1" runat="server">
<ext:FitLayout ID="FitLayout1" runat="server">
<ext:GridPanel runat="server" ID="grid" StoreID="store">
<ColumnModel ID="ColumnModel1" runat="server">
<ext:RowNumbererColumn Fixed="true">
<ext:Column DataIndex="LastName" Header="Last Name">
<ext:Column DataIndex="FirstName" Header="First Name">
<ext:CheckboxSelectionModel runat="server">
<LoadMask ShowMask="true" />
<ext:GridView ForceFit="true">
<ext:Button runat="server" ID="btnLoad" Text="Reload">
<Click Handler="#{store}.reload()" />

Nov 14, 2008, 2:13 PM
Hi jchau,

You can set Type=Load for store requests

<AjaxEventConfig Type="Load">

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"

Nov 14, 2008, 3:03 PM
Thanks! That worked.