ajax should not be a technology,Is just a thought,It has nothing to do with asp.net and other web development languages.Here I just talk about the ajax technology currently used in asp.net and some other excellent frameworks that implement ajax.Interested friends follow us to learn how to implement asp.net and ajax

ajax has been popular for a while,Now talking about ajax is a bit old-fashioned,-_____- `` `. At present, the so-called web2.0 website basically does not use ajax, just like using rss, just like a tag,Paste it and become 2.0. Ajax specific details are not discussed,The purpose is to let the user trigger some actions,The page does not refresh all,Refresh only the "partial pages" to be updated. During the loading process,Use loading images to indicate that data is being loaded,Not only does it look good,It also improves the user experience.There is a cool feeling.

As for ajax used in asp.net, I think most people use ajax.net/ajaxprofessional or the atlas framework included in asp.net 2.0. Because I have used them all,I don't think these are good ajax solutions.

ajaxpro is not very convenient to use,The page needs to be registered in page_load.Similar to

private void page_load (object sender, system.eventargs e)
  ajaxpro.utility.registertypeforajax (typeof (dataaccess.myajax));

And the aspx page should include atag with runat=server, so that ajax.net will load some common functions used and your custom functions,If you don't have<asp:from>Add it manually.However, in applications I have done before,Some problems that often appear,For example, it is often found that the browser status bar will have js script errors,At this time, all the ajax effects you made will be invalidated.The solution is,Just overwrite that ajax.dll /ajaxpro.dll,What is the cause of the problem,I don't know yet.

As for atlas, I actually feel the same way about datagrid.Well, this kind of control is easy to use.Convenient, but when you really do some web applications,You have to consider various issues such as performance and layering.I think that in more formal web applications, few people use datagrid to display some data.It is recommended that you use these controls as little as possible.The other thing is,Atlas's execution efficiency is really not ideal.Been there loading, waiting for a long time,What script error occurred,sweat.

Is there any other solution?You can write some javascript functions to achieve it.However, I recommend using the javascript framework jquery here, quoted from Baidu Encyclopedia:

jquery is another excellent javascrīpt framework after prototype. Its purpose is to write less, do more, write less code,Do more things.

It is a lightweight js library (only 21k after compression), which is beyond the reach of other js libraries.It is compatible with css3, and also compatible with various browsers (ie 6.0+, ff 1.5+, safari 2.0+, opera 9.0+).

jquery is a fast,The concise javascript library makes it easier for users to process html documents, events, and achieve animation effects.And easily provide ajax interactions for your website.

Another big advantage of jquery is thatIts documentation is very comprehensive,And the applications are very detailed,There are also many mature plugins to choose from.

jquery keeps user's html page separated from html content,That is,No need to insert a bunch of js in html to call commands,Just define the id.

It seems that this introduction you will know,The ajax effect is just one of many features of jquery.Generally speaking,The use of ajax in web applications is inseparable from javascript, and jquery encapsulates some js functions for everyone, so that you don't worry about the complexity of js.Everything is done for you by jquery.

Look at a small example,You know that ajax with jquery is too convenient.

For example, there is a button in an aspx or html page. Clicking triggers ajax to load data.Displayed in<span id=news> ;. Clicking that button triggers a js function:

function getnews ()
      $("#news"). html ("loading news ...");
      $.ajax ({
        type:"post",        url:"/ajax.aspx?act=getnews",        datatype:"html",        data:"",        success:function (result)
          $("#news"). html (result);

This function will first display "loading news ...." in that span. Through asynchronous call,Visit the /ajax.aspx page.Tell the page what type of data is needed by passing the url parameter act=news,You can use different parameters,Write the data directly to the page through ajax.aspx,Then return to the above js function and render it on the page,It's that simple!

The above content is the implementation of asp.net and ajax shared with you,Hope you like it.

  • Previous windowonload usage guide
  • Next Summary of PHP code to determine whether a visit is a search engine spider or an ordinary user