|
Step 1: Create an application in Iron Speed Designer using a database table, such as the Orders table in Northwind.
Step 2: In the HTML layout page file for ShowOrdersTablePage, delete all content between the
...and the...
...tags.
Step 3: Add the following content to replace the previous content:
<!--Table View Area -->
<tr>
<td class="tableRowsEdge">
<GEN:ITEMTEMPLATE Name="OrdersTableItem" ></GEN:ITEMTEMPLATE>
<asp:datagrid id="myDataGrid" runat="server">
<HeaderStyle BackColor = "#336699" ForeColor = "#ffffff" Font-Bold = "true" />
<AlternatingItemStyle BackColor = "#eeeeee" />
</asp:datagrid>
</td>
</tr>
<!-- Totals Area -->
|
Step 4: Override the DataBind method in the TableControl class of the ShowOrdersTablePage.aspx web page.
For .NET Framework 1.1, add your code in the OrdersTableControl class, located in:
|
...\<Application Folder>\Orders\ShowOrdersTablePage.aspx.cs or .vb
|
For .NET Framework 2.0 / 3.0, add your code in OrdersTableControl class, located in:
|
...\<Application Folder>\App_Code\Orders\ShowOrdersTablePage.Controls.cs or .vb
|
C#:
public override void DataBind()
{
base.DataBind();
if (this.DataSource == null)
{
return;
}
BindPaginationControls();
System.Web.UI.WebControls.DataGrid grid = (System.Web.UI.WebControls.DataGrid)(this.FindControl("myDataGrid"));
this.PopulateCustomerIDFilter(MiscUtils.GetSelectedValue(this.CustomerIDFilter,
this.GetFromSession(this.CustomerIDFilter)), 500);
this.PopulateEmployeeIDFilter(MiscUtils.GetSelectedValue(this.EmployeeIDFilter,
this.GetFromSession(this.EmployeeIDFilter)), 500);
System.Data.DataTable table = OrdersTable.Instance.CreateDataTable(this.DataSource);
grid.DataSource = table;
grid.DataBind();
}
|
Visual Basic .NET:
Public Overrides Sub DataBind()
MyBase.DataBind
If (Me.DataSource Is Nothing) Then
Return
End If
BindPaginationControls
Dim grid As System.Web.UI.WebControls.DataGrid =
CType(Me.FindControl("myDataGrid"),System.Web.UI.WebControls.DataGrid)
Me.PopulateCustomerIDFilter(MiscUtils.GetSelectedValue(Me.CustomerIDFilter,
Me.GetFromSession(Me.CustomerIDFilter)), 500)
Me.PopulateEmployeeIDFilter(MiscUtils.GetSelectedValue(Me.EmployeeIDFilter,
Me.GetFromSession(Me.EmployeeIDFilter)), 500)
Dim table As System.Data.DataTable = OrdersTable.Instance.CreateDataTable(Me.DataSource)
grid.DataSource = table
grid.DataBind
End Sub
|
Step 5: Build and run your application.
|