ASP.NET MVC Tutorials

JQuery DataTables Paging, Sorting and Searching with ASP.NET Web API

JQuery DataTables Paging, Sorting and Searching with ASP.NET Web API

In my previous tutorial Using JQuery DataTables with ASP.NET Web API, I covered the basics of JQuery DataTables plugin. Sometimes, it makes sense to go beyond the basics to make sure the data you are displaying is not only loading fast but also easy for the user to read and understand. If you have thousands of rows of data in database table you can’t simply display all of them at once. You have to avoid information overload by loading the data in chunks. You have to allow users to control how much they want to see and in which order they want to see it. DataTables plugin has built in support for client to server side searching, sorting and pagination using AJAX calls. We can search and filter to zero in on what's relevant. We can change the order, allowing for easy comparison. In this tutorial I will show you how you can enable searching, sorting and paging features of the plugin and use ASP.NET Web API on the server side to support these features.

Using JQuery DataTables with ASP.NET Web API

Using JQuery DataTables with ASP.NET Web API

JQuery DataTables plugin is one of the most powerful plugin for creating tabular listings of your data and adding user interactions to it. It has built in support for searching, sorting and pagination without any configuration. It also has some advanced features such as support for AJAX, server side processing and styling the grid according to some of the popular frameworks e.g. Bootstrap, Material Design etc. As a seasoned .NET professional, I always wanted to connect DataTables with some backend data source using ASP.NET Web API so that I can not only take advantage of the .NET platform on the server side but also use DataTables for my front end needs such as dashboards or advance user interfaces. In this tutorial I will go through the basics of DataTables and will show you how you can use JQuery DataTables with ASP.NET Web API. In my next tutorial JQuery DataTables Paging, Sorting and Searching with ASP.NET Web API, I will show you how you can enable searching, sorting and paging features of the plugin and use ASP.NET Web API to support these features.


Creating Custom Validation Attribute in ASP.NET MVC

Creating Custom Validation Attribute in ASP.NET MVC

Data validation is intended to provide certain well-defined guarantees for fitness, accuracy, and consistency for various kinds of user input into an application. For business applications, data validation can be defined through declarative data integrity rules or procedure-based business rules. Data that does not conform to these rules will negatively affect business process execution. In ASP.NET MVC applications, System.ComponentModel.DataAnnotations namespace contains various DataAnnotation attributes that gives you a simple way to apply different validation rules on model data. These attributes are helpful for common validation requirements like Required, Range, RegularExpression, StringLength etc. However sometimes you require custom validation for custom business rules. In this tutorial, I will show you how to implement a custom validation attribute by inheriting the built in ValidationAttribute base class and will include functionality to output HTML5 data-* attributes for use with client side validation.

Calling ASP.NET MVC actions using JQuery AJAX

Calling ASP.NET MVC actions using JQuery AJAX

JQuery is one of the most common libraries used in web development today and it has been used very frequently by ASP.NET MVC developers for not only enhance the user experience but also to provide dynamic contents to their web application users using different type of AJAX calls supported by JQuery. JQuery provides several methods such as get, getJSON, load, post, ajax which can be used to call different types of ASP.NET MVC controller’s actions. In this tutorial, I will show you how you can use JQuery get method to call ASP.NET MVC actions.