Go to a Specific Page in a Table Panel

"Write a code customization to go to a specific page in a table panel in your generated Iron Speed Designer application."
- Anh Trinh, Software Engineer, Iron Speed, Inc.

November 8, 2006
Iron Speed Designer V4.0

Go to a Specific Page in a Table Panel
You can easily write a code customization to go to a specific page in a table panel, such as page 14 of 30. One way to do this is to pass the page number on the URL, for example:

http://localhost/MyApp1/Orders/ShowOrdersTablePage.aspx?page=14

To implement this mechanism, override the Page_Load_InitPageSettings() method for the Page class and set the PageIndex to the value passed via the URL. Then, call the DataBind() method to refresh the page. The example below adds this customization to a Show Table page built using the Orders table in the Northwind database, located in:

.NET Framework 1.1 and 2.0:

...\<App Folder>\Orders\ShowOrdersTablePage.aspx.cs or .vb

The code customization is inserted into the ShowOrdersTablePage class.

C#:

protected override void Page_Load_InitPageSettings(object sender, EventArgs e)
{
    if (!(this.IsPostBack))
    {
        if (this.Request.QueryString["page"] != null)
        {
            this.OrdersTableControl.PageIndex = (int.Parse(this.Request.QueryString["page"])) - 1;
            this.DataBind();
        }
    }
    base.Page_Load_InitPageSettings(sender, e);
}

Visual Basic .NET:

Protected Overrides Sub Page_Load_InitPageSettings(ByVal sender As Object, ByVal e As EventArgs)
    If Not Me.IsPostBack Then
        If (Not (Me.Request.QueryString("page")) Is Nothing) Then
          Me.OrdersTableControl.PageIndex = (Integer.Parse(Me.Request.QueryString("page"))
          - 1)
          Me.DataBind
        End If
    End If
    MyBase.Page_Load_InitPageSettings(sender, e)
End Sub

About the Author
Anh Trinh
Software Engineer, Iron Speed, Inc.

Anh is a software engineer at Iron Speed, Inc. He enjoys developing applications with Iron Speed Designer and Microsoft .NET technology.



  Privacy Statement