AJAX-Enabling a GridView Control with Atlas
In my last post, I pointed out some of the problems with AJAX. In this post, I'll show you to take the ASP.NET GridView control and AJAX-enable it in about 30 seconds using Microsoft's new Atlas framework.
The GridView control is one of the most powerful and commonly used components of the .NET framework. With it, we can easily display data from a datasource such as SQL Server and enable things like sorting, editing, paging, and deleting. All of this can be done with little or no code. Every time you execute a GridView function (such as switching pages) a postback occurs and the entire page reloads. Wouldn't it be great if we could update the GridView dynamically without the need for a postback every time?
The Atlas framework makes this not only possible, but extremely simple.
Step 1 – Download and install the Atlas Framework
Step 2 – Create a new Atlas project and make a new web form with a GridView control bound to a datasource. The Northwind database will work well for this.
Step 3 – Add an Atlas ScriptManager Control to the page and enable partial rendering.
<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
Step 4 – Surround your GridView control with an Atlas UpdatePanel conrol.
<atlas:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" ... />
</ContentTemplate>
</atlas:UpdatePanel>
Step 5 – Save it. Run it. Marvel at how simple that was.
4 Comments
hai,
I have used GridView and used the paging. if I want to search the particular text in gridview how to search and get the value. Because here i have used paging but my search text may be in 4 page.how to get my text using any button is out of gridview
Posted by: senthilkumar | April 27, 2007 3:23 AM
hai ,
when we use the paging in gridview in .net 2.0, how can we take the 2nd page value suppose if 1st page have 10 rows and 2ns page has 3 row.Here we should get the 2nd page value(12 row value) from First page is visible.
please send the code.
Posted by: senthil kumar | April 27, 2007 4:19 AM
Hi,
Just want to share with you guys the fact that there is a AJAX GridView walkthrough tutorial about auto-refresh GridView using AJAX.
This tutorial is at http://www.KYNOU.com
under: Tutorial Index->Ajax
Posted by: Joao Silva | May 29, 2007 8:02 PM
Here is some example of implementing the "CheckALL" button functionality. The paging is of 5 records.
if (Session["checkAll"].ToString() == "true")
// for n records, replace 5 with n and 4 with n-1
{
int n = 0;
if (GridView1.Rows.Count
Posted by: cschiopu | July 17, 2007 8:52 AM