Delay on next Ajax.NET Release

Because I got more good ideas I didn't uploaded the next release, yet. I will do some more checking first, because I already implemented these nice cool features. On some Windows Mobile PCs the Ajax.NET wrapper is not working fine. Perhaps I will release the next version without full support for all Pocket PCs.

For the examples I am searching for small projects that will show how and where to use the Ajax.NET wrapper. If you have a short example please send me your Visual Studio .NET project files or only the parts that are interesting.

I got already the info that Ajax.NET is working on all current web browsers (Internet Explorer, Netscape, Opera, Firefox, Safari,...)!!

26 Comments

  • Michael Schwarz said

    @Chua Wen Ching: Yes, the next release will be available May, 7th. Today we have a holiday here in Germany, I will have enough time.

    @Conrad: Please use my contact form at this web site to contact me.

  • Mark E. said

    Several things...

    About AJAX.NET---
    1) I like your AJAX.NET. Very nice. Good work.
    2) Sorry about the OpenSourcing of it. I'd suggest using the LGPL license as that would mean any changes to the code (in an assembly) would be under the LGPL license but it would permit a closed source application to link to the assembly without requiring it to be opensource. This stops the perceived "viral" problem like the GPL can have.
    3) I've contributed to several online opensource projects before and I would like to help you with this. You can host it on www.sourceforge.net. I can help you with that if needed. I run one project and am a member of another. One of which involved code generation.

    About using AJAX.NET---
    4) I would like to put specific logic into a User Web Control on my form but I'm hitting problems. Have you done this before? My problem is that the user web control is not instantiated when my function fires on the main page. Any advice?

    Thanks. Good stuff.

  • Michael Schwarz said

    1) ;)

    2-3) I will come back to you if I finished my discussion with other
    partners or developers.

    4) What do you want to do with the control? I had done a example for a
    list box control that will be filled at client side after selecting
    one item. Can you tell me more what you want to develop?

  • Mark E. said

    2-3) That's cool. I'll check your blog periodically to see if you do find a license and hosting that work for you. I have some ideas that I would like to discuss with you for additional features. What is the best way to do that?

    4) I created a user web control that has a table, graphics, and a repeater in it. It also has javascript code and other stuff in the HTML side. I can correctly generate the HTML code for the user web control but I can't do it from an AJAX event call. Just for testing, I created the AJAX method on the main page that contains the user web control. However, in the method I could not work with the control. Doing a "FindControl()" returns null. The instance of the class had not been created. Maybe it would work to register the user web control and call that one directly? I'll have to play some more. I was just wondering if you had done it before.

  • Mark E. said

    Regarding #4 of my previous posts...

    I got it to work, sort of. The client correctly makes the call to the class on the server. The problem is that the class does not appear to be correctly instantiated (created). When I Quick Watch "this" it shows that all the web controls on the class (a User Web Control) are not created. This includes a repeater, some command buttons and a Label. These are delcared like this...

    public class ThumbnailListControl : System.Web.UI.UserControl
    {
    protected System.Web.UI.WebControls.ImageButton cmdPrev;
    protected System.Web.UI.WebControls.Label lblCurrentPage;
    protected System.Web.UI.WebControls.ImageButton cmdNext;
    protected System.Web.UI.WebControls.Repeater galleryItems;
    [...]

    I see why they are not created (no explicit "new" commands), but I don't understand why they are created when the Page_Load happens normally. Can AJAX.NET, when creating a class like System.Web.UI.UserControl, auto-instantiate members like this? That way the user doesn't have to have different initialization steps for different call methods.

    Sorry if too long. Thanks for the earlier answers.

  • Andrew Cupper said

    Mark, I think you will need to use Page.LoadControl or UserControl.LoadControl. A user control consists of two parts, markup which is in the ascx and a code-behind class defined in the ascx.cs. Ajax is loading the class, but not parsing the markup which is used to instantiate the controls in the user control. You would need to create a new class which instantiates your user control (using LoadControl), and call this new class with ajax. I'm not sure this will work though, since you need to call LoadControl using an instance of a page or user control, and you may have trouble creating one correctly. You _may_ get away with creating a very simple user control which just provides access to the LoadControl method, but you'll have to try it and see...

  • Mark E. said

    I tried it out and found a few issues but I think I can make it work. I'll have to play with it some more. Not as easy as I was hoping. :(

  • Michael Schwarz said

    - full unicode support
    - Windows Mobile PC (Pocket PC) support
    - possibility to replace the common javascript
    - cached javascript proxy files
    - more object converters with source code
    - context support on client javascript
    - strong named assembly
    - ...

  • Como fazer um currículo said

    Do you know how to write a ClientValidationFunction for a CustomValidator getting the result from a ServerSide (Ajax) function?

    I tried it, but I can't convert the client args object to server args object (System.Web.UI.WebControls.ServerValidateEventArgs).

    thanx,
    Thiago RS

  • scott e said

    Hey --
    I forgot to tell you that I got it working with DotNetNuke --no problems now. It was because the app rewrites the urls, and I needed to tell it not to do so for .ashx files...

  • Mark E. said

    Michael,
    I would like to contribute to AJAX.NET. I have some ideas on how to improve it for use with User Web Controls. I got the user controls to work. It took some doing but went OK. The idea is that I can create a control to display/edit a Person object and add it as needed to a portion of the rendered page. I wanted to be able to manage the layout and design easily on the server but have the client display it as needed. One problem I ran into with ASP.NET controls is that an edit or some other input control cannot be rendered except when it is contained withint a <form> block. But ASP.NET 1.1 does support nested <form> blocks, so you have to do some tweaking or don't use .NET web controls for it.

    Scott,
    I ran into the problem of ASP.NET controls re-writing the URLs also. How did you tell it not to? Is that a property I missed?

  • scott e said

    if you do a search in the globals.vb file for a function called 'GetDomainName', you will see some code that looks like this:

    <snip>
    For intURL = 2 To URL.GetUpperBound(0)
    Select Case URL(intURL).ToLower
    Case "admin", "controls", "desktopmodules", "mobilemodules", "premiummodules", "providers", "ajax"
    Exit For
    Case Else
    ' exclude filenames ENDing in ".aspx" or ".axd" ---
    ' we'll use reverse match,

    </snip>

    -- you will see that I appended the 'ajax' to the end of the Case statememt.

    **This must be the path name that is in your web.config file (this won't work if you just cut and pasted the example web.config...)



    I would also like to add a suggestion -- when you call a function on the server and it returns asynchronously, it would be nice if the return could include an object that is filled before the function is called on the server...

    ie: callFnOnServer(p1,p2, holdingObject, callbackObject);

    ... then...

    callFnOnServer(response, holdingObject)

    Thanks--



  • Bobby said

    Michael

    All I want to do is receive a few fields from a particular row in my sql database.

    I use a data adapter, then search through the rows using datarow()

    I seem to get a null returned when I fill my dataset
    > Me.daSqlTest.Fill(Me.DsSqlTest1)

    Bobby

  • Mark E. said

    @Bobby:
    Put a try..catch around the server-side call. Something like this...
    try
    {
    [somecalls];
    }
    catch (Exception e)
    {
    return e.Message;
    }

    You can put the message directly to the page or put a breakpoint there to get the message or log it or something. One pitfal with AJAX currently is that ASP.NET excpetions are handled by displaying it at the browser. But errors in AJAX calls don't go to the browser in that way. This will at least help you figure out what the problem is.

    I'd like to see about building a better default exception handling for AJAX.NET.

  • Trin said

    Hello Mark,

    I saw that you got this working for ASCX Controls. I have issues there. When i try to execute something like

    treeMainContent_ascx.ServerSide(CallBack_Function); It fails.

    I am not sure how to debug this or why it is happenning. Any help would be wonderful.

    Thanks

  • Mark E. said

    Trin,

    As I mentioned before, the only way to get information out about an error in an AJAX call is to catch it. See the code fragment in my previous post.

    In your AJAX method on the server, you need to put a try..catch block around all your code. You can put a breakpoint on the "return e.Message;" call from earlier. Also, depending on what the function is returning, you can just display the error text on the page somewhere.

    I would like to add better built in exception handling for AJAX if permitted.

    Hope this helped!

    -Mark E.

  • Michael Schwarz said

    @Mark E.: Why do you need to add try..catch to the Ajax methods? If there is an error thrown I will return this error message to the client. On the client-side you can use res.error instead of res.value to get detailed error info.

Comments have been disabled for this content.