Contents tagged with jQuery

  • One Time Event Handlers using jQuery and ASP.NET

    Most of the times the JavaScript event handlers attached with an element fire every time the event under consideration is raised. For example, if you wire a click event handler to the click event of a button then clicking that button will invoke the event handler function every time. At times, however, this behavior is undesirable. You can unsubscribe the click event handler when it gets executed the first time. That means you need to create event handlers that fire only one time. Luckily, jQuery provides an inbuilt way to accomplish this task - one() method.

    Read more...

  • 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.

    Read more...

  • Creating a Slide Show Using the History API and jQuery

    During Ajax communication, page content is often modified in some way or another. Since Ajax requests are sent through a client side script, the browser address bar remains unchanged even if the page content is being changed. Although this behavior doesn't create any problem for an application's functionality, it has pitfalls of its own. That's where History API comes to your rescue. History API allows you to programmatically change the URL being shown in the browser's address bar. This article demonstrates how History API can be used with an example of a slide show.

    Read more...

  • Posting GridView Data to MVC Controller

    Visual Studio 2013 provides a unified development environment for ASP.NET Web Forms and ASP.NET MVC applications. This unified environment is called as One ASP.NET. What it means for developers is that a single project can use Web Forms, MVC controllers and Web API. Under One ASP.NET at times the existing Web Forms may want to send and receive data to and from the MVC controllers. This article illustrates how this task can be accomplished.

    Read more...

  • My latest book - Beginning jQuery 2 for ASP.NET Developers

    Beginning jQuery 2 for ASP.NET Developers - Written specifically for ASP.NET Developers, this book covers all the essential information about using jQuery with ASP.NET Web Forms and ASP.NET MVC applications. Covers Selectors, Event Handling, DOM Manipulation, Ajax, Effects and Animations, Plugin development, introduction to jQuery Mobile and jQuery UI and more. For details visit:

    Read more...

  • Creating Wizard in ASP.NET MVC (Part 3 - jQuery)

    In Part 1 and Part 2 of this article series you developed a wizard in an ASP.NET MVC application using full page postback and Ajax helper respectively. In this final part of this series you will develop a client side wizard using jQuery. The navigation between various wizard steps (Next, Previous) happens without any postback (neither full nor partial). The only step that causes form submission to the server is clicking on the Finish wizard button.

    Read more...

  • Introduction to Developing Mobile Web Applications in ASP.NET MVC 4

    As mobile devices are becoming more and more popular, web developers are also finding it necessary to target mobile devices while building their web sites. While developing a mobile web site is challenging due to the complexity in terms of device detection, screen size and browser support, ASP.NET MVC4 makes a developer's life easy by providing easy ways to develop mobile web applications. To that end this article introduces you to the basics of developing web sites using ASP.NET MVC4 targeted at mobile devices.

    Read more...

  • Dealing with JSON Dates in ASP.NET MVC

    Most of the time, data transfer during Ajax communication is facilitated using JSON format. While JSON format is text based, lightweight and simple it doesn't offer many data types. The data types supported in JSON include string, number, boolean, array, object and null. This support for limited data types poses some difficulties while dealing with dates. Since there is no special representation for dates in JSON, ASP.NET uses its own way to deal with dates. This article discusses how dates are serialized in JSON format by MVC action methods and how to deal with them in your client side jQuery code.

    Read more...

  • Using Custom Data Attributes to Store JSON Data in ASP.NET MVC

    HTML5 custom data attributes (data-*) are used to store arbitrary pieces of metadata about an element. One way to store such metadata in data-* attributes is to create a separate data-* attribute for each piece of information you wish to store. This approach works well if there are only a few data-* attributes. However, at times you need to store a bunch of metadata in data-* attributes. In such cases instead of creating multiple data-* attributes you can create just one data-* attribute and store all the pieces of metadata as an object in JSON format. To that end this article illustrates how custom data attributes can be used to store JSON data in an ASP.NET MVC application.

    Read more...

  • Displaying File Upload Progress using jQuery UI Progressbar Widget

    While uploading large files you may need to display the progress of the file upload operation to the end user. This can be done using HTML5 and jQuery UI's Progressbar widget. While HTML5 also has progress element that can be used to render a progress bar, jQuery UI's Progressbar widget offers more configuration and theming options. In this post you will use XMLHttpRequest (Level 2) object to upload files to the server. The XMLHttpRequest object now supports file upload related events such as progress that can be used to track file upload progress.

    Read more...