|
In some cases it may be desirable to pass calculated values from one page to another via a page’s URL.
For example, you might wish to pass the grand total of a table column on one page as an input value to another
page:
|
http://MyApp/Page.aspx?Total= FreightGrandTotal.Text()
|
Or you might wish to pass the value of a dynamically retrieved session variable to a page:
|
http://MyApp/Page.aspx?Value=Session("Test")
|
You can do this with a code customization that overrides the ModifyRedirectUrl() method in the Page class.
In the example below, the grand total of the UnitPrice column in the Products table is passed as a
URL parameter when the “New” button is clicked on the ShowProductsTablePage.aspx page. The grand total
is passed via URL to the AddProductsPage.aspx page.
Step 1: In the Design tab in Iron Speed Designer, click the Configure… button on the Products
table panel. This displays the Table Panel Wizard.
Step 2: In the Table Panel Wizard, select the Totals tab and select UnitPrice for the grand total
column. Your generated application will automatically calculate the grand total.
Step 3: Override the ModifyRedirectUrl method in the ShowProductsTablePage class of the ShowProductsTablePage.aspx
page.
.NET Framework 1.1 and 2.0:
|
...\<App Folder>\Products\ShowProductsTablePage.aspx.cs or .vb
|
C#:
public override string ModifyRedirectUrl(string redirectUrl, string redirectArgument)
{
String modUrl = redirectUrl;
If (redirectUrl.Equals("../Products/AddProductsPage.aspx"))
modUrl += "?Total=" + UnitPriceGrandTotal.Text;
return base.ModifyRedirectUrl(modUrl, redirectArgument);
}
|
Visual Basic .NET:
Public Overrides Function ModifyRedirectUrl(ByVal redirectUrl As String, ByVal redirectArgument As String) As String
If (redirectUrl.Equals("../Products/AddProductsPage.aspx")) Then
redirectUrl = redirectUrl + "?Total=" + UnitPriceGrandTotal.Text
End If
Return MyBase.ModifyRedirectUrl(redirectUrl, redirectArgument)
End Function
|
|