DataGridAdapter
The DataGridAdapter control simplifies the sorting and paging of DataGrid controls with various data sources.
Features
- Handles the sorting and paging of a datagrid.
- Uses a simple event to control necessary databinding to a datasource.
- Allows a history of sort expressions to enable sorting by multiple columns.
- Enables easy alternating sort expressions.
- Works with DataSets, DataReaders, and custom business objects
- Optionally hide the DataGrid's Pager when there is only one page of records.
- Supports high performance custom paging.
- Can eliminate page index errors, using last available page.
- This is an aspect oriented control, not a composite control, which has a few advantages:
- You have full control of the layout using a regular DataGrid control.
- Is easily added to existing datagrids.
Code Example
<%@ Register TagPrefix="fluent" Namespace="Fluent"
Assembly="Fluent.DataGridAdapter" %>
<html>
<head>
<script language="C#" runat="server">
protected void DataGridAdapter1_DataGridBinding(
DataGridAdapter sender, DataGridBindingEventArgs e) {
SqlDataAccessCommand command;
...
DataGridAdapter1.DataSource = command.ExecuteReader();
}
</script>
</head>
<body>
<form runat="server">
<asp:DataGrid
ID="DataGrid1"
Runat="server"
AllowSorting="True"
AllowPaging="True"
PageSize="10"
/>
<Fluent:DataGridAdapter
ID="DataGridAdapter1"
Runat="Server"
DataGridToBind="DataGrid1"
SortHistory="1"
AutoDataBind="True"
HideEmptyPager="True"
OnDataGridBinding="DataGridAdapter1_DataGridBinding"
/>
</form>
</body>
</html>
VB Code Example
Protected Sub DataGridAdapter1_DataGridBinding(ByVal sender As DataGridAdapter,
ByVal e As DataGridBindingEventArgs)
Dim command As SqlDataAccessCommand
...
DataGridAdapter1.DataSource = command.ExecuteReader()
End Sub
Copyright © 2002-2003 Fluent Consulting. All rights reserved.