Ajax.NET Professional Beta 5.11.24.1 available

Tags: .NET, AJAX, Ajax.NET, ASP.NET

I posted a new version to the Google group. Attached you will find a beta version of the next version. I had to recode a lot of parts to get the queue working correct with 2 http connections. Now, if you add this assembly you have to be careful if you use inheritance from the AjaxPro.AjaxRequest. You have to inherit from AjaxPro.AjaxClass instead, now.

1) The extra line "AjaxPro.queue = new AjaxRequestQueue();" is not needed, it is the default configuration.

2) You can specifiy an onLoading, onError, onTimeout and onStateChanged event for the class instance (wrapper) and you can use it as arguments for each method:

Namespace.Class.Method(param1, param2, ..., callback, context, onLoading, onError, onTimeout, onStateChanged);

If you have specified an event on the class it will be used if you didn't used a different one in the method arguments.

3) The timeout has to be configured at AjaxPro.timeoutPeriod, default is 5 seconds.

4) There are now more JavaScript files: prototype.ashx, core.ashx and converter.asjx. These three files and the wrapper files are
automatically added to your page if you use the RegisterTypeForAjax method. If you want to use your own JavaScript files you can override each path in the web.config:

<ajaxNet>
  <ajaxSettings>
    <scriptReplacements>
      <file name="prototype" path="~/scripts/prototype.js" />
      <file name="core" path="~/scripts/core.js" />
      <file name="converter" path="~/scripts/converter.js" />
    </scriptReplacements>
...

If you remove the path attribute nothing is rendered to the client except the JavaScript wrappers.

7 Comments

  • Martin van der Geer said

    Will it be possible in future releases to use Enums? Because currently it doesnt work in Ajax.NET :(

    Or am i missing something? RegisterEnumForAjax doesnt work, and i cant declare an enum with AjaxEnum because its deprecated :/ Also, the AjaxNamespace is not available for enum's.

    Other question: will the source code for Ajax.NET ever be open source?

  • INeedADip said

    My question is: Do I have to pass that function as a parameter with
    every call or can I setup it up once?

    Do I have to call all my functions like:
    Namespace.Class.Method(param1, param2, ..., callback, context,
    onLoading, onError, onTimeout, onStateChanged);

    Or can I do something like:

    AjaxPro.onError = errorFunction;

    function errorFunction(e){
    alert(e);
    }

    Then just call my [AjaxPro.AjaxMethod] functions passing only
    parameters they expect and the callback, with errors being redirected
    automaticaly?

    function test(){
    TestFunctions.GetPerson(1, test_callback);
    }

    function test_callback(res){
    alert(res.Age);
    }

    I hope that makes sence. I have asked this question twice in the Google Group, but nobody has been able to help me.

    Before posting in the group and asking you, I have tried it, but couldn't get it to work. Now I am just wondering if it is possible, if it is, I'll keep trying to figure it out.

  • Sinclair said

    This method fails to serialize the properties marked with [AjaxProperty] attribute when the containing class is marked with [AjaxNonSerializable].
    I can see an intent to do this within the method code. However, the method searches the property getter _method_ for the AjaxProperty attribute. Consider the following example:
    [AjaxNonSerializable]
    public class Person
    {
    [AjaxProperty]
    public string Name
    {
    get { return &quot;Peter&quot;; }
    set { }
    }
    }

    Property Person.Name is missing in the serialized representation. This example would work as expected:

    [AjaxNonSerializable]
    public class Person
    {
    public string Name
    {
    [AjaxProperty]
    get { return &quot;Peter&quot;; }
    set { }
    }
    }

    But the AjaxPropertyAttribute cannot be actually applied to methods.

    Therefore, I consider this to be a bug in the JavaScriptSerializer.SerializeCustomObject implementation. Please make sure method looks into the custom attributes of property, not property getter.

Comments have been disabled for this content.