View Full Version : [CLOSED] AjaxMethod issue

Oct 06, 2008, 5:45 AM
I tried to implement the authentication sample, but I can't get it to work, and I dn't have any clue why.
Here is my code


<ext:ScriptManager ID="ScriptManager1" runat="server" />

<ext:Window ID="LoginWindow" runat="server" Closable="false" Resizable="false" Height="150"
Icon="Lock" Title="Authentification" Draggable="false" Width="350" Modal="true"
<ext:FormLayout ID="FormLayout1" runat="server">
<ext:TextField ID="txtUsername" runat="server" FieldLabel="Identifiant" AllowBlank="false"
BlankText="Votre identifiant est requis." EmptyText="monadresse@mail.com" Width="200px" />
<ext:TextField ID="txtPassword" runat="server" InputType="Password" FieldLabel="Mot de passe"
AllowBlank="false" BlankText="Votre mot de passe est requis." EmptyText="Mot de passe"
Width="200px" />
<ext:Label ID="lblMessage" runat="server" />
<ext:Button ID="btnLogin" runat="server" Text="Connection" Icon="Accept">
<Click Handler="if(!#{txtUsername}.validate() || !#{txtPassword}.validate()) {
Ext.Msg.alert('Erreur','L\'identifiant et le mot de passe sont requis');
// return false to prevent the btnLogin_Click Ajax Click event from firing.
return false;
}" />
<Click OnEvent="btnLogin_Click">
<EventMask ShowMask="true" Msg="Vérification..." MinDelay="500" Target="CustomTarget"
CustomTarget="#{LoginWindow}" />


Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs)
lblMessage.SetText("Identifiant ou mot de passe incorrect")
End Sub

Now the problem is that it doesn't work that way, as it throw a "BADRESPONSE, syntax error" window. Any help would be appreciated.
Also, the error windows displays just fine with ff, but the 4 supposedly hidden fields are displayed as inputs with ie. Hiding them would be really appreciated :p

Edit : I meant AjaxEvents issue, sry -_-

Oct 06, 2008, 6:40 AM
Hi Rod,

Please add the following node to your Web.config file to enable AjaxEvents.


  <add name="AjaxRequestModule"
   type="Coolite.Ext.Web.AjaxRequestModule, Coolite.Ext.Web" />
More information is available within the README.txt file which is included in all the manual installation packages and gets installed to your "Start" menu if you run the .exe installer.

I'll post the full contents of the relavent README.txt section below.

Version: 0.6.0
Last Updated: 2008-10-02</p>


The release of Version 0.6.0 has introduced a new feature called
"AjaxEvents". The AjaxEvents enable an Ajax postback to be attached to
any event.</p>

The AjaxEvents perform a full PostBack, but does this threw the use of Ajax.
The Page will go threw it's entire page life-cycle as a classic postback,
although will only return JavaScript in the response. The JavaScript is
then executed on the client on successful round trip. </p>

No HTML is returned from the AjaxEvent. Currently, a new control can not
be created during an AjaxEvent. All controls that require updating on the
client must be available in the Page .Controls Collection before the
AjaxEvent executes. </p>

To enable the AjaxEvents functionality you must add the following
"AjaxRequestModule" node to your projects Web.config file.</p>


  <add name="AjaxRequestModule"
   type="Coolite.Ext.Web.AjaxRequestModule, Coolite.Ext.Web" />

Once the "AjaxRequestModule" has been added to the web.config, you can
trigger an AjaxEvent by adding to the <AjaxEvents> property of each
Coolite Toolkit control.</p>

The following demonstrates setting the <Click> AjaxEvent on an
<{0}:Button> and then calling .Show() on an <{0}:Window> control. </p>


<script runat="server">
    protected void Button1_Click(object sender, AjaxEventArgs e)

<{0}:Button ID="Button1" runat="server" Text="Show Window">
        <Click OnEvent="Button1_Click" />

Hope this helps.

Oct 06, 2008, 6:49 AM
I'm sorry I HAVE read the read me, and I HAVE read that I need to add this node, but i'm just too stupid to remember it more than 10 min :/

Working fine now, sry again :(

Oct 06, 2008, 6:55 AM
No problem. I'm happy to help.

I'm hoping to have the controls automatically add the reference to the AjaxEvents Module within the next release. We had to leave it out of the v0.6 release because of some possible Visual Studio crashing issues that may have been caused by us trying to dynamically write to the web.config file.

Oct 06, 2008, 7:23 AM
That would be nice idd, as i'm afraid some ppl will also forget this point :/