Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. AJAX

AJAX

Scheduled Pinned Locked Moved C#
csharpvisual-studioquestion
16 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Jamie Nordmeyer

    AJAX stands for Asynchronous Javascript and ActiveX, and is not related to .NET, though in my humble opinion, .NET DOES make it easier to deal with. AJAX makes use of an object available in most browsers 4.0 and above, commonly called XmlHttpRequest, if memory and laziness to verify this right now serve me correctly, and as such, is simply a technology you can use in just about any web based technology. My personal favorite AJAX implementation is one called My Ajax.NET, soon to be called Anthem.NET, and is a completely free implementation. You can find it here: http://jason.diamond.name/weblog/category/my-ajax-dot-net/[^] Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan Portland, Oregon, USA

    L Offline
    L Offline
    leppie
    wrote on last edited by
    #4

    Jamie Nordmeyer wrote:

    My personal favorite AJAX implementation is one called My Ajax.NET, soon to be called Anthem.NET, and is a completely free implementation. You can find it here: http://jason.diamond.name/weblog/category/my-ajax-dot-net/\[^\]

    It has moved to http://anthem-dot-net.sourceforge.net/[^] xacc.ide-0.1.1 released! :) Download and screenshots

    J 1 Reply Last reply
    0
    • P ppp001

      Hi, Is Ajax technology related to .Net ? And where can I get the IDE or SDK for AJAX development ? Thanks

      I Offline
      I Offline
      imsathy
      wrote on last edited by
      #5

      it is there in vs 2005 and the upcoming vs2006.... but can also implement it in vs 2003. the code is not posted back to the server every time so it saves a lot of time retreiving the data and this is done thro xml and javascript either a webservice or a page with script should act as a data layer.

      P 1 Reply Last reply
      0
      • J Jamie Nordmeyer

        AJAX stands for Asynchronous Javascript and ActiveX, and is not related to .NET, though in my humble opinion, .NET DOES make it easier to deal with. AJAX makes use of an object available in most browsers 4.0 and above, commonly called XmlHttpRequest, if memory and laziness to verify this right now serve me correctly, and as such, is simply a technology you can use in just about any web based technology. My personal favorite AJAX implementation is one called My Ajax.NET, soon to be called Anthem.NET, and is a completely free implementation. You can find it here: http://jason.diamond.name/weblog/category/my-ajax-dot-net/[^] Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan Portland, Oregon, USA

        P Offline
        P Offline
        ppp001
        wrote on last edited by
        #6

        Thanks, so do you think it is easy to program with ? As it seems need to deal with DOM, xml, javaScript, so many technology together.... And what are the differences in the programming paradigm when compared it to normal client server implementation ? Do it need to take care the many states changing in both the server and the client browser ?....

        J 2 Replies Last reply
        0
        • I imsathy

          it is there in vs 2005 and the upcoming vs2006.... but can also implement it in vs 2003. the code is not posted back to the server every time so it saves a lot of time retreiving the data and this is done thro xml and javascript either a webservice or a page with script should act as a data layer.

          P Offline
          P Offline
          ppp001
          wrote on last edited by
          #7

          Thanks, Is it embedded into the ASP.Net in VS2005 ? or how can I get started to develop with it ? Any good reference for starters ?

          I 1 Reply Last reply
          0
          • J Jamie Nordmeyer

            AJAX stands for Asynchronous Javascript and ActiveX, and is not related to .NET, though in my humble opinion, .NET DOES make it easier to deal with. AJAX makes use of an object available in most browsers 4.0 and above, commonly called XmlHttpRequest, if memory and laziness to verify this right now serve me correctly, and as such, is simply a technology you can use in just about any web based technology. My personal favorite AJAX implementation is one called My Ajax.NET, soon to be called Anthem.NET, and is a completely free implementation. You can find it here: http://jason.diamond.name/weblog/category/my-ajax-dot-net/[^] Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan Portland, Oregon, USA

            D Offline
            D Offline
            Dario Solera
            wrote on last edited by
            #8

            NOOOOOOOO!!! AJAX: Asynchronous Javascript And XML ;) ___________________________________ Tozzi is right: Gaia is getting rid of us. My Blog [ITA] - eMule Server .NET

            J 1 Reply Last reply
            0
            • P ppp001

              Thanks, Is it embedded into the ASP.Net in VS2005 ? or how can I get started to develop with it ? Any good reference for starters ?

              I Offline
              I Offline
              imsathy
              wrote on last edited by
              #9

              ya but i dunno much abt it since im workin in vs2003...... i have an app which i developed using this AJAX(it might be useful) if needy how can i post tht to u..... sathy

              P 1 Reply Last reply
              0
              • L leppie

                Jamie Nordmeyer wrote:

                My personal favorite AJAX implementation is one called My Ajax.NET, soon to be called Anthem.NET, and is a completely free implementation. You can find it here: http://jason.diamond.name/weblog/category/my-ajax-dot-net/\[^\]

                It has moved to http://anthem-dot-net.sourceforge.net/[^] xacc.ide-0.1.1 released! :) Download and screenshots

                J Offline
                J Offline
                Jamie Nordmeyer
                wrote on last edited by
                #10

                Unfortunately, though, Anthem is still in alpha phase. I've used My Ajax.NET up through version 11, and it's rock solid. I'm looking forward to seeing, though, what he does with Anthem when it's finalized. But thanks for posting the link. :) Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan Portland, Oregon, USA

                1 Reply Last reply
                0
                • D Dario Solera

                  NOOOOOOOO!!! AJAX: Asynchronous Javascript And XML ;) ___________________________________ Tozzi is right: Gaia is getting rid of us. My Blog [ITA] - eMule Server .NET

                  J Offline
                  J Offline
                  Jamie Nordmeyer
                  wrote on last edited by
                  #11

                  :laugh::laugh::laugh: D'Oh! You're right. I was pretty tired when I wrote that original reply. Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan Portland, Oregon, USA

                  1 Reply Last reply
                  0
                  • P ppp001

                    Thanks, so do you think it is easy to program with ? As it seems need to deal with DOM, xml, javaScript, so many technology together.... And what are the differences in the programming paradigm when compared it to normal client server implementation ? Do it need to take care the many states changing in both the server and the client browser ?....

                    J Offline
                    J Offline
                    Jamie Nordmeyer
                    wrote on last edited by
                    #12

                    My Ajax.NET is extremely easy to use. You can either add the .cs file directly to your project, as it's implemented in a single file, or, if you prefer, or are using something other than C#, you can compile it in to a .dll file, and add a reference in your project to it. From there, calling server functions from your client side is a 2 stop process. First, you need to register your page class with the library, then you need to expose methods for your client script to call. This is done using attributes.

                    public class MyTestPage : System.Web.UI.Page
                    {
                    protected void Page_Load(object sender, EventArgs e)
                    {
                    // The second param is used to name the class used in your client side code.
                    // So if you expose a method called GetTable, you'd call it in your Javascript
                    // like this: Callback.GetTable();
                    Ajax.Manager.Register(this, "Callback");

                      if (!Page.IsPostBack)
                      {
                         ...
                      }
                    

                    }

                    // Next, we define our callback methods. They MUST be scoped as public, and you mark
                    // them using the Ajax.MethodAttribute. If you don't need the values from your server
                    // controls, mark IncludeControlValuesWithCallBack as false.
                    [Ajax.Method(IncludeControlValuesWithCallBack = false))]
                    public int Add(int x, int y)
                    {
                    return x + y;
                    }

                    // We can return back several object types as well, including DataTable objects.
                    [Ajax.Method()]
                    public DataTable GetClientInfo(int clientID)
                    {
                    return this.ConnectToDatabaseAndRetrieveData(clientID);
                    }
                    }

                    Second, you just call them from your client side as if they were Javascript functions:

                    <script language="javascript">
                    function onSomeButtonClick()
                    {
                    var cmb = document.getElementById('cmbClients');
                    var clientID = cmb.options[cmb.selectedIndex].value;

                    // Now we call our callback method, whose code is implemented server side.
                    var dtbl = Callback.GetClientInfo(clientID);

                    // We can now use our datatable as follows:
                    for (var i = 0; i < dtbl.Rows.length; i++)
                    {
                    alert(dtbl.Rows[0].ClientName + '\n' +
                    dtbl.Rows[0].Address1 + '\n' +
                    dtbl.Rows[0].City + '\n' +
                    dtbl.Rows[0].State + '\n' +
                    dtbl.Rows[0].ZipCode);
                    }
                    }
                    </script>

                    Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan Portland, Oregon, USA

                    1 Reply Last reply
                    0
                    • P ppp001

                      Thanks, so do you think it is easy to program with ? As it seems need to deal with DOM, xml, javaScript, so many technology together.... And what are the differences in the programming paradigm when compared it to normal client server implementation ? Do it need to take care the many states changing in both the server and the client browser ?....

                      J Offline
                      J Offline
                      Jamie Nordmeyer
                      wrote on last edited by
                      #13

                      I forgot to answer your second question. The differnce between AJAX and traditional web application implementation is that with traditional web apps, when you needed to talk to the server, you did a post back. The web browser would bundle up the value of all controls nested in an HTML FORM element, append those values to an HTTP request, and send that request to the server. Once the server received the request, it would run code written by the page designer to process the sent data. What the server would send back was a full page of HTML markup, forcing the browser back at the client to completely redraw itself. For large forms, this was mostly acceptable. But what if you just needed to update a single control based on the selected value of another? A good example is the sites where you can select a state from a drop down, and another dropdown on the form then populates with the cities in that state. AJAX allows you to avoid posting back the entire form if you want, and allows you to avoid having to redraw the entire page just to update a field or two. With AJAX, if someone changes the state dropdown on the example above, I can, behind the scenes, ask the server for JUST the cities of that state, and it will return it to me in some format set up by the server side developer. Maybe as an XML blob, or a delimted string. Your javascript on the client is responsible for clearing out the cities dropdown, and repopulating it. The user experience is cleaner this way, and closer to what they'd see in a traditional Windows application because only the changing element refreshes; not the whole page. You must be careful, though, to use AJAX only where it's appropriate. You DO NOT want to try and send a 10,000 record datatable to the client, and expect the users of your site to be happy with you as their browser first waits for all the records to come to it, then draws your table. Compiled code is almost always faster than script, so for major operations like a 10,000 record table, do the work server side. Now, as for state changes, since you're not actually refreshing the page when you make a callback, state isn't an issue. If you need to have the current values of your server side controls when you call back, make sure that on the server side, your callback function is attributed as such:

                      [Ajax.Method()]
                      public void SumFunc()

                      Or

                      [Ajax.Method(IncludeControlValuesWithCallBack = true)]
                      public void SumFunc()

                      Kyosa Jamie Nordm

                      1 Reply Last reply
                      0
                      • P ppp001

                        Hi, Is Ajax technology related to .Net ? And where can I get the IDE or SDK for AJAX development ? Thanks

                        K Offline
                        K Offline
                        Kevin McFarlane
                        wrote on last edited by
                        #14

                        Apart from that MyAjax .NET thing, MS have a tool called Atlas in development. Kevin

                        1 Reply Last reply
                        0
                        • I imsathy

                          ya but i dunno much abt it since im workin in vs2003...... i have an app which i developed using this AJAX(it might be useful) if needy how can i post tht to u..... sathy

                          P Offline
                          P Offline
                          ppp001
                          wrote on last edited by
                          #15

                          thank so much ! Could you send the app to me via email : shirleylstam@yahoo.com.hk ?

                          I 1 Reply Last reply
                          0
                          • P ppp001

                            thank so much ! Could you send the app to me via email : shirleylstam@yahoo.com.hk ?

                            I Offline
                            I Offline
                            imsathy
                            wrote on last edited by
                            #16

                            mailed u the app sathy

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups