|
Step 1: Create an Add Record page using the New Page dialog or Application Wizard in Iron Speed
Designer. For this example, use the Customers table in the Northwind database.
Step 2: Delete the Save and Cancel buttons since we won’t need to save any data to the database in
the first step of our wizard.
Step 3: Click "Configure..." in the Record panel to display the Record Panel Wizard. In the Fields
tab, remove all of the fields except CustomerID, CompanyName, ConctactName, and ContactTitle. Then click "Finish".
Step 4: Drag and drop a button from the tool box within the Add Record panel. Set the button text to
"Next".
Step 5: Double click the "Next" button to display the Properties dialog box for the button. On the
Bindings tab, set these properties:
| Property |
Setting |
| Button Command |
Redirect |
| Action after command |
Go to a specific URL Specify the path of the second page as the URL. |
On the Attributes tab, set these properties:
| Property |
Setting |
| Button-CausesValidation |
True This ensures the data on the first page will be validated before the second page is displayed. |
Step 6: Override the Button_Click() method in the AddCustomerPage class in the first page,
located in:
.NET Framework 1.1 and 2.0:
|
...\<App Folder>\Customers\AddCustomersPage.aspx.cs or .vb
|
Handle the command for the button as shown below. In this function, the data values are stored in
session variables.
C#:
public void Button_Click(object sender, EventArgs args)
{
//store data in session variables
System.Web.HttpContext.Current.Session["Customer"] = this.CustomerID.Text;
System.Web.HttpContext.Current.Session["CompanyName"] = this.CompanyName.Text;
System.Web.HttpContext.Current.Session["ContactName"] = this.ContactName.Text;
System.Web.HttpContext.Current.Session["ContactTitle"] = this.ContactTitle.Text;
Button_Click_Base(sender, args);
}
|
Visual Basic .NET:
Public Sub Button_Click(ByVal sender As Object, ByVal args As EventArgs)
System.Web.HttpContext.Current.Session("Customer") = Me.CustomerID.Text
System.Web.HttpContext.Current.Session("CompanyName") = Me.CompanyName.Text
System.Web.HttpContext.Current.Session("ContactName") = Me.ContactName.Text
System.Web.HttpContext.Current.Session("ContactTitle") = Me.ContactTitle.Text
Button_Click_Base(sender, args)
End Sub
|
|