Skip to main content

Latest Articles: GridView


sorttable: Make all your tables sortable
Entry Date: Apr 2008 site: Kryogenix Rating:
keywords:ASP .net; GridView; Java Script; HTML;
Article Description:
While the web design community gradually moves away from using tables to lay out the structure of a page, tables really do have a vital use, their original use; they're for laying out tabular data. For instance, imagine a table of employees.
Comments:

Pretty cool stuff... imaging that you have created an HTML table (lots of TR / TD stuff) and you provide functionallity to the final user to sort by column just clicking on the headers... without any postback or async call to the server or whatever any nasty stuff

If you have to show a table without pagination, this approach it's pretty powerful, all the operation is performed real time on the client side via javascript. It's a lite approach, worth to give a try, in some scenarios it could be better than using a GridView.

Click Here To Navigate to the Article

What’s Ailing ASP.NET Web Forms?
Entry Date: Feb 2008 site: Code Magazine Rating:
keywords:ASP .net; AJAX ASP .net; GridView; Performance; Viewstate; HTML; VS 2008; ASP .net Futures; UpdatePanel; Partial Rendering; ScriptManager; Visual Studio 2008;
Article Description:
Microsoft’s recent announcement that ASP.NET will soon get an alternate engine in the ASP.NET Model View Controller framework (MVC-see last month’s editorial) has brought out some renewed discussion of the merits and shortcomings of Web Forms and the potential need for an alternate mechanism of building Web applications that provide a closer and purer model to raw Web development. This is true especially in light of the different development style that AJAX/Web 2.0 applications are introducing and some of the complications that it raises with the Web Forms development lifestyle.
Comments:

Ms is going to release this year their implementation of the MVC pattern... this means: do not use web forms anymore, do not use updatepanel or partial rendering, do not use viewstate... do not use anything that can postback :-).

Are Web forms dead? Do Web forms sucks? What are the advantages and drawbacks?

Quite interesting topic and article.

Click Here To Navigate to the Article

How do I reduce this ViewState thing?
Entry Date: Feb 2008 site: Weblogs ASP .net Rating:
keywords:ASP .net; AJAX ASP .net; GridView; Performance; Viewstate; .net framework 2.0; Web Services; Networking; UpdatePanel; Partial Rendering;
Article Description:
ViewState is a hugely useful feature of ASP.NET, but it's easy to misuse. It's also a little difficult to apprehend for ASP.NET beginners as it's working behind the scenes. The only thing you see at first is this huge blob on your page source.
Comments:

Viewstate plus UpdatePanel: performance killer, sucks, slow pages, ...

Well, yes... UpdatePanel sends the full viewstate on each request, if you have a huge viewstate you will have a lot of problems (I have seen 1 Mb and 2 Mb pages due to ViewState, think about that big chunk travelling on every single partial rendering post).

Good news are... you don't need to rewrite your app using Script Services / Web Services (a bit complex), you can just disable the ViewState control by control and keep that data to bind in session, by using that you can reduce the ViewState to the max (and reduce the cases where you need to use Script Services), the most usual performance killer is the combination of GridView + ViewState.

Click Here To Navigate to the Article

Export a GridView to Excel...
Entry Date: Sep 2007 site: Dotnet John Rating:
keywords:ASP .net; GridView; .net framework 2.0; Office; DataSet; HTML; Excel;
Article Description:
A couple of years ago we presented an article on exporting DataGrids to Excel. This is an updated article demonstrating one way to export a GridView to Excel.
Comments:

How to export a GridView into Excel in a very easy way: It does the trick by capturing the HTML render of the Grid and send it back to the client with the content type marked as Excel format.

If you don't need to add formulaes, or complicated stuff, this apporach it's pretty straightforward.

Click Here To Navigate to the Article

Working with the ASP.NET 2.0 ObjectDataSource Control
Entry Date: Sep 2007 site: MSDN Rating:
keywords:ASP .net; GridView; .net framework 2.0; ADO .net;
Article Description:
The SqlDataSource make two-tiered data access easy in ASP.NET 2.0. However, this control isn't as helpful in n-tier applications, where the ObjectDataSource provides that same ease of use for business objects. Learn how to use the ObjectDataSource control to build a proper multi-tier Web application with the ASP.NET 2.0 Framework. (17 printed pages)
Comments:

ObjectDataSource allows you to use the nice features of declaring data access in the ASPX files and keep your n-tier approach to develop applications.

ObjectDataSource it's a very powerful abstraction, but you will need to spend some time learning about how to use it. In this excellent article you will find how to feed the ObjectDataSource with parameters (e.g. a GridView that contains dropdown filters, or querystring parameters, cookies...)

Click Here To Navigate to the Article

Sorting Custom Paged Results
Entry Date: Sep 2007 site: 4GuysFromRolla Rating:
keywords:ASP .net; GridView; .net framework 2.0; T-SQL; DataReader;
Article Description:

Last week I wrote an article on implementing custom paging in ASP.NET 2.0 aptly named Custom Paging in ASP.NET 2.0 with SQL Server 2005. In that article I covered how to efficiently page through large amounts of data using Typed DataSets, an ObjectDataSource control, and SQL Server 2005's new ROW_NUMBER() keyword. Custom paging intelligently grabs just the subset of records needed to display per page, whereas default paging, while easier to implement, suffers when paging through sufficiently large data because all records are retrieved with each page of data. As my unscientific tests showed in Custom Paging in ASP.NET 2.0 with SQL Server 2005, paging through a 50,000 record database took over two seconds to display each page of data with default paging, while custom paging was able to chew through each page in under 0.03 seconds!

Nothing is free in life, and such is the case with custom paging. While custom paging offers astoundingly better performance when paging through large results, it is more difficult to implement. Furthermore, once custom paging has been added, even more work must be done to allow the user to sort the results. In this article we'll see how to augment custom paging to include support for bi-directional sorting of the results. Read on to learn more!

Comments:

If you need achieve high performance on your site,you should remove your "training wheels Datasets" and implement custom paging in your GridView.

In previous articles has been explained how to implement the basic of custom paging on a gridview (including the T-SQL part, using RANK new functionallity), in the current one you will learn how to add the order by column functionallity (need some dynamic SQL to make it work, the sorting won't be performed any more in the application side).

Click Here To Navigate to the Article

Custom Paging in ASP.NET 2.0 with SQL Server 2005
Entry Date: Sep 2007 site: 4GuysFromRolla Rating:
keywords:ASP .net; GridView; Performance; .net framework 2.0; T-SQL;
Article Description:
This article highlights features new to SQL Server 2005 that make retrieving a particular paged subset of data incredibly easy and efficient. For those who've yet to switch to SQL Server 2005, check out A More Efficient Method for Paging Through Large Result Sets. The stored procedure presented in that article can be plugged in for the stored procedure examined in this article if needed.
Comments:

Using Datasets and Gridview is not a bad combination for most of the scenarios (simple intranet, websites that won't have heavy traffic, or executing queries that returns thousands of rows), you can take advantage of built in caching functionallity and the easy of use of this combination (you get sorting and paging functionallity "for free").

Well... not really for free you pay a price in performance, if you have to develop a site that needs to have a superb performance, you should think about using custom datasources (read the data using sqlDatareaders) and take advantage of SQL Server 2005 new T-SQL features for paging (only retrieve the results of the current page using RANK functions).

Click Here To Navigate to the Article

Displaying Extended Details in a GridView Using an Ajax Pop-Up (Part 2)
Entry Date: Jul 2007 site: 4GuysFromRolla Rating:
keywords:ASP .net; AJAX ASP .net; GridView; T-SQL; Web Services;
Article Description:

This two-part article series examines how to use Microsoft's ASP.NET AJAX to add a pop-up control to a GridView in order to display drill-down detail information in a responsive and clean manner. In Part 1 we looked at displaying the list of employees from the Northwind database in a GridView. This involved building an application architecture consisting of a Data Access Layer (DAL) created via Typed DataSets and a Business Logic Layer (BLL) created as custom classes. We then created an ASP.NET page that used a GridView and an ObjectDataSource to invoke the appropriate BLL method and display the results.

In this second and final installment we'll turn our attention to Ajax-ifying the GridView by adding the pop-up control to display the territories coverred by the moused over employee. This will involve creating a dynamic populate page method that will be called asynchronously from the browser when the user mouses over an employee. This call back to the web server will return the specified employee's list of territories, which will then be displayed in the pop-up. Read on to learn more!
Read More >

Comments:

AJAX in practice, how to use it applied to a GridView (the sample is a magnifier that shows an AJAX toolkit popup control extender with additional information).

Clients always ask to have nice featured inside a cell of a GridView. This tutorial shows you how to create a rich user experience, without having to write tons of code.

Click Here To Navigate to the Article

Tip and Tricks: ASP.NET 2.0 AJAX 1.0 Extensions and Master Pages
Entry Date: Jun 2007 site: ASP Alliance Rating:
keywords:ASP .net; AJAX ASP .net; GridView; Java Script;
Article Description:
In this article, Bilal Haidar explores the different ways in which you can integrate ASP.NET 2.0 AJAX 1.0 UpdatePanels into your Web application using Master Pages.
Comments:

Very interesting article. It teachs you how to integrate AJAX scriptmanager in your master page and how to use ScriptManagerProxy to enable you adding javascript code without having to register it on calling it from the master page.

You will find info about the main event that you receive in your page from AJAX (BeginRequestHandler, initializeRequest, ...) so you can have control over the AJAX calls.

It contains interesting info about how to use script manager without instantiating it on the master page

Click Here To Navigate to the Article

Filtering Custom Paged Results
Entry Date: Apr 2007 site: 4GuysFromRolla Rating:
keywords:ASP .net; GridView;
Article Description:

The ASP.NET 2.0 data web controls - the GridView, DetailsView, and FormView - all provide built-in paging support that can be enabled at the tick of a checkbox. Unfortunately, this built-in paging support is very inefficient when paging through large amounts of data since it naively grabs all of the records from the data being paged through even though only a subset of the records are displayed. Consequently, when paging through several hundred or thousands of records, it behooves you to implement custom paging. With custom paging, the data Web control hands over its paging responsibilities to us, the page developer. We are tasked with efficiently grabbing the precise subset of records to display and providing this information to the data Web control.

Previous articles here on 4Guys have looked at implementing custom paging in ASP.NET 2.0. In Custom Paging in ASP.NET 2.0 with SQL Server 2005 we looked at using a GridView, a Typed DataSets, an ObjectDataSource control, and SQL Server 2005's new ROW_NUMBER() keyword to efficiently page through 50,000 records 10 at a time. Another article, Sorting Custom Paged Results, looked at a technique for efficiently sorting the custom paged results.

In addition to paging and sorting, another common data request is filtering. When using the inefficient default paging, filtering is easy to implement but includes the same inherent inefficiencies: the data Web control retrieves all of the filtered records even though only a subset of them are displayed on each page. It is possible to implement filtering with custom paging and sorting, however. In this article we will look at extending the custom paging and sorting example - which currently pages and sorts through the 50,000 employees in a fictional company - to include the ability to filter the displayed employees by their department. Read on to learn more!

Before tackling this article make sure you have read and worked through Custom Paging in ASP.NET 2.0 with SQL Server 2005 and Sorting Custom Paged Results...
Read More >

Comments:

This is one of the GridView "Black Art", you cna find links about:

  • How to perform custom paging using an DataReader.
  • How to perform sorting using an DataReader.
  • [This one] How to perform filtering over a GridView that uses custom paging.

One drawback of this article, is that it only shows you the declarative way of adding filter (just in the ASPX indicating asp controls), you can as well use custom classes to hold the parameter information that you want to keep:

<SelectParameters> <asp:Parameter DefaultValue="null" Name="filters" Type="Object" /> </SelectParameters>

And overriding the ObjectDatasource event OnSelecting.

Click Here To Navigate to the Article

Page (1) Of 1