Contents tagged with AJAX

  • AngularJS Directive That Invokes ASP.NET MVC Action

    Recently one of the readers asked whether an AngularJS directive can invoke ASP.NET MVC actions. This article shows how a simple AngularJS directive can be created that invokes an ASP.NET MVC action using Ajax. Usually an AngularJS directive is used to perform some UI centric operation. However, nothing prevents an AngularJS directive from invoking some server side code (say an action method) to get some job done.

  • Implementing Ajax Login in ASP.NET MVC

    Implementing Ajax based login involves many of the same steps as the normal forms authentication. However, the login page doesn't send user ID and password to the server through a standard form submission. Instead, user credentials are sent to the server via an Ajax request. The credentials are then validated on the server and the result of the verification process is conveyed to the client. If the login attempt was successful, the user is taken to the secured area of the website.

  • Creating Wizard in ASP.NET MVC (Part 2)

    In Part 1 of this article series you developed a wizard in an ASP.NET MVC application. Although the wizard developed in Part 1 works as expected it has one shortcoming. It causes full page postback whenever you click on Previous or Next button. This behavior may not pose much problem if a wizard has only a few steps. However, if a wizard has many steps and each step accepts many entries then full page postback can deteriorate the user experience. To overcome this shortcoming you can add Ajax to the wizard so that only the form is posted to the server. In this part of the series you will convert the application developed in Part 1 to use Ajax.

  • Creating Cascading DropDownLists using ASP.NET MVC 4 and jQuery

    Sometimes you need to display DropDownLists in your ASP.NET MVC views such that values in one DropDownList are dependent on the value selected in another DropDownList. The most common example of such a functionality is countries and states DropDownLists where based on a selected country you need to populate the states DropDownList. This article shows how such a cascading DropDownLists can be developed using ASP.NET MVC and jQuery.

  • Working with Ajax Helper in ASP.NET MVC

    Ajax driven web applications are quite common these days. While you can use libraries such as jQuery to make Ajax calls to ASP.NET MVC action methods there is an inbuilt way to Ajax enable your forms - Ajax helper. Using Ajax helper you can submit your HTML form using Ajax so that instead of refreshing the entire web page only a part of it can be refreshed. Additionally, you can also render action links that allow you to invoke action methods using Ajax. This article examines these two techniques provided by the Ajax helper.

  • Using Microsoft Ajax Minifier Tool to Minify JavaScript Files

    The increased use of JavaScript and libraries based on JavaScript (such as ASP.NET AJAX and jQuery) results in a considerable amount of JavaScript being downloaded on the client side. The need for large amounts of JavaScript to be downloaded may result in your website getting a performance penalty for obvious reasons. In such cases it is recommended to reduce the size of JavaScript files by using minification techniques. To that end Microsoft Ajax Minifier, a tool to compress JavaScript and CSS files, can greatly reduce the size of such files thus improving the performance of your web application. In this article you will learn the basics of using Microsoft Ajax Minifier tool and certain programming recommendations to get most out of the minification process.

  • Using Microsoft Ajax CDN to Refer ASP.NET AJAX and jQuery Files

    Modern web applications rely heavily on client side scripting to provide rich user experience. To that end ASP.NET AJAX and jQuery are popular choices amongst ASP.NET developers to render rich user interface. These libraries make use of client script physically stored in JavaScript (.js) files. When a client accesses a web form that makes use of these libraries the client browser first needs to download the required library files on the client side and then execute the client script. Developers often store these JavaScript files as a part of their web site and then refer to them in various web forms. Though this approach works, it's not the best approach to make use of such client side libraries. That is where Content Delivery Network or CDN comes into picture. As an ASP.NET developer it would be nice to know what a CDN is and how Microsoft Ajax CDN can be used in ASP.NET web sites to refer ASP.NET AJAX and jQuery files. The remainder of the article discusses these concepts.

  • Consuming ASMX and WCF Services using jQuery

    In the previous part I demonstrated how jQuery animations can add some jazz to your web forms. Now let's see one of the most important feature of jQuery that you will probably use in all data driven websites - accessing server data. In the previous articles you used jQuery methods such as $.get() to make a GET request to the server. More powerful feature, however, is to make AJAX calls to ASP.NET Web Services, Page Methods and WCF services. The $.ajax() method of jQuery allows you to access these services. In fact $.get() method you used earlier internally makes use of $.ajax() method but restricts itself only to GET requests. The $.ajax() method provides more control on how the services are called.

  • ASP.NET AJAX Enabled Web Site File Manager

    Now that Microsoft has released Atlas...sorry ASP.NET AJAX, lots and lots of applications are going to use it (many are already using it). Here is a simple but handy tool that I wrote using ASP.NET AJAX and the Control Toolkit.