PDA

View Full Version : [FIXED] [V0.8.0] AjaxMethod Type=AjaxEventType.Load still sends back post data



jchau
Jan 20, 2009, 11:17 PM
How can I get an AjaxMethod to not send post data (including viewstate) back to the server? I tried setting the Type to Load on the AjaxMethod attribute, but it is still sending back post data.

ASPX


<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server" Theme="Default" />

<asp:TextBox runat="server" ID="txt"></asp:TextBox>

<input type="button" value="Go" &#111;nclick="Coolite.AjaxMethods.ButtonClick();return false;" />
</form>

VB


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack AndAlso Not Ext.IsAjaxRequest Then
Me.txt.Text = "Set Once"
End If
End Sub

<AjaxMethod(Type:=AjaxEventType.Load)> _
Public Sub ButtonClick()
'should return empty string
Me.ScriptManager1.AddScript(String.Format("alert('{0}');", Me.txt.Text))
End Sub

jchau
Jan 20, 2009, 11:21 PM
Type is not documented in AjaxMethods Overview page in Examples Explorer, but source code shows I can set it to 'Load'on client side and then it works.  So I guess the server side setting is ignored.  Is there a global place where I can change the default from 'Submit' to 'Load'?  About 80% of the time, I want the Type to be 'Load'.

Vladimir
Jan 26, 2009, 1:12 PM
Hi,

The Type property of AjaxMethodAttribute is fixed.