Remember Me
forgot your password?

Sorting Gridview Data With Ajax

This tutorial was created with Visual Studio .NET 2008, but can still be recreated with 2005. Microsoft's ASP.NET AJAX Extensions for 2005 can be downloaded at this link.

In this tutorial, we will look at how we can use the GridView Control to display data Asynchronously, and how we can sort data in real-time, using AJAX. We will simply create a sample database, but you can use your own if you have one in mind, and we will add a button and a GridView to the ASPX page. Then we will display the data upon button click and allow sorting in real-time.

The first thing we will do is create the sample database. For this example, we will just use a table with names and cities, with some sample data. The next thing we will do is add the button, gridview and sqldatasource - then create the data source to our database:













ConnectionString=""
SelectCommand="SELECT * FROM [Table1]">



Notice that we have also associated the datasource with our gridview, set our gridview to allow sorting, and created a click event for our button. This click event will make the gridview visible, when clicked:





protected void butPopulate_Click(object sender, EventArgs e)
{
GridView1.Visible = true;
}

At present, the functionality will work as intended, but the whole page will post back - creating a delay for the user. What we want to do is to AJAX-enabled this page. We will add a ScriptManager and an UpdatePanel, so our ASPX page will now look something like this:


















ConnectionString=""
SelectCommand="SELECT * FROM [Table1]">





Our entire code-behind looks like this:

Please follow the link to ajaxtutorials.com to continue with the tutorial and code. Happy coding!

Ajax Tutorials
Rate this Article: 5 / 5 stars - 1 vote(s)
Print Email Re-Publish

Add new Comment



Captcha

  • Latest Programming Articles
  • More from Ajax Tutorials

PDF Reports

By: chaudhary fahim | 02/01/2010
Portable document format is known as PDF that is popular file format.

iPhone Web Applications: Helping You Make Merry

By: Arun Kumar | 02/01/2010
The increasing popularity of the Apple iPhone has inspired a whale of iPhone web applications developers design and develop the most efficient apps for the device. By downloading them from the web sites of the development companies and then installing them onto the device, you can also be on top of the world.

Syntax Not Understood Error For Robots.txt File in Google Webmaster Tools

By: Murat Yasar | 01/01/2010
I saw a strange error in my webmaster tools account when I reviewed robots.txt file. It was saying that syntax not understood.

Websites Development: Make Your Presence Felt in the Online World

By: Arun Kumar | 01/01/2010
For corporate enterprises, these companies offer a site development which can give a strong corporate identity for your business which has the potential to impress potential clients, partners, and customers. For small businesses, the designs offered are usually affordable and customizable with easy site navigation.

How to Locate and Make the Most of an iPhone Web Development Company?

By: Arun Kumar | 01/01/2010
By installing the iPhone apps, be it the web based or the business or entertainment based, you can easily broaden your wings of achievement all easily. All sorts of iPhone apps are now becoming extremely popular because of their ease of use. They can be easily downloaded from the web just by paying a very reasonable amount to the developers.

Integrating facebook in cakephp

By: Digisha Modi | 30/12/2009
FaceBook Application is the powerful tool of marketing or to connect people for all type of business. Now it's easier to find social applications on Facebook, on your phone, and on external websites. The new "Featured by Facebook" section highlights Facebook's favorites. Since 2007 the kind of concept FaceBook has come up with become a unique challenger to established payers. The benefit of FaceBook application is any one can post their own application with out any cost.

Outsourcing of iPhone Application Development Offers Profits for Developers as Well as Users

By: Arun Kumar | 30/12/2009
Being a 3G phone, it offers users the advantage of thrilling web access which helps them being on top of all online activities even on the move. Also, there are several additional applications available for download for the device. Thanks to the efforts of the outsource iPhone application development firms which have helped iPhone users get more with their devices using the apps developed by their expert developers.

Magento Template Integration

By: Digisha Modi | 30/12/2009
If you have purchased Magento template or simply need to integrate an existing graphic design template into your e-commerce shop we will integrate it into Magento for you. A web template is a ready- made web design need to be integrated. Usually web templates make possible a standardized layout (page arranging, colors, positions, etc.) for different web contents while using the same basic layout.

Sorting Gridview Data With Ajax

By: Ajax Tutorials | 12/08/2008 | Programming
In this tutorial, we will look at how we can use the GridView Control to display data Asynchronously, and how we can sort data in real-time, using AJAX. We will simply create a sample database, but you can use your own if you have one in mind, and we will add a button and a GridView to the ASPX page. Then we will display the data upon button click and allow sorting in real-time.

Submit Your Articles Free: Signup
Article Categories




Use of this web site constitutes acceptance of the Terms Of Use and Privacy Policy | User published content is licensed under a Creative Commons License.
Copyright © 2005-2008 Free Articles by ArticlesBase.com, All rights reserved. (0.07, 1, w2)