i got problems with my class file. most of the errors saying that 'Object reference not set to an instance of an object'. it looks like all functions in class file cannot be performed, even i do declare the class at code-behind file. do i have to call the class file in .aspx page? like this <%# Imports ... %>. this is page for CheckOut.aspx.vb.
Partial Class Checkout_CheckOut
Inherits System.Web.UI.Page
Private order As Order
Private cust As Customer
Private cart As ShoppingCart
Protected Sub Page\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
cart = Session("cart")
If Session("order") Is Nothing Then
order = New Order(DateTime.Now, Nothing, Session("cart"))
Session("order") = order
Else
order = Session("order")
cart = order.Cart
End If
cust = New Customer(txtEmail.Text, txtLastName.Text, txtFirstName.Text, \_
txtAddress.Text, txtCity.Text, txtState.Text, txtPostCode.Text, txtPhone.Text, \_
txtEmail.Text)
order.Cust = cust
lblSubtotal.Text = order.SubTotal.ToString("c")
lblShipping.Text = order.Shipping.ToString("c")
lblTotal.Text = order.Total.ToString("c")
End Sub
Protected Sub Wizard1\_FinishButtonClick(ByVal sender As Object, ByVal e As \_
System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick
' process credit card information here
Dim success As Boolean
success = OrderDB.WriteOrder(order) 'the function WriteOrder from OrderDB class
Session("cart") = Nothing 'can't be performed
Session("order") = Nothing
If success Then
Response.Redirect("Confirmation.aspx")
Else
Response.Redirect("Confirmation.aspx?Error=1")
End If
End Sub
End Class