yanayaya 0 Newbie Poster

Hello there, welcome to my first post :)

Im having problems in my .net app with my c# code not being able to see a few labels and textboxes that I have in my wizard. I have 3 text boxes and a couple of labels I would like to reference but I keep getting the error "The name '...' does not exist in the current context."

I also have a OrderDB class within App_Code directory that I referenced and I am getting the same error with that as well (as if it cannot see it). I tried to deleting my auto generated deisgner.cs file and recreating it but that has not helped.
The elements that are throwing this error are as follows:

- txtFirstname.txt
- txtLastName.txt
- txtEmail.txt
- lblSubtotal
- lblShipping
- lblTotal
- OrderDB.WriteOrder

Im sure its just a small case of using find control but I do not know how to implement that when there is a wizard involved. Then there is the problem with OrderDB not being found in the current content. OrderDB is a class with a sql transaction in it and it is stored in the App_Code directory. I just dont know whats going on or why Im getting this error on build.

Notes: Build in Framework 4.0 using VWD 2010 Express.

Here is my code:


<asp:Wizard ID="Wizard1" runat="server" Width="420px" ActiveStepIndex="1" FinishCompleteButtonText="Submit PO" OnFinishButtonClick="Wizard1_FinishButtonClick"> 
       <asp:WizardStep ID="WizardStep1" runat="server" Title="User"> 
             Please confirm your name. 
            <asp:Label ID="lblFirstName" runat="server" Text="First Name:" /><asp:TextBox runat="server" ID="txtFirstName" /><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtFirstName" ErrorMessage="Required" Display="Dynamic" /><br /> 
            <asp:Label ID="lblLastName" runat="server" Text="Last Name:" /><asp:TextBox runat="server" ID="txtLastName" /><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtLastName" ErrorMessage="Required" Display="Dynamic" /><br /> 
            <asp:Label ID="lblEmail" runat="server" Text="Email:" /><asp:TextBox runat="server" ID="txtEmail" /><asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtEmail" ErrorMessage="Required" Display="Dynamic" /><br /> 
       <asp:WizardStep ID="WizardStep2" runat="server" Title="Supplier"> 
        <asp:WizardStep runat="server" Title="Confirmation"> 
          Your Purchase Order is ready to be processed. 
          <asp:Label ID="lblSubtotal" runat="server" Text="Sub Total:" /><br /> 
          <asp:Label ID="lblShipping" runat="server" Text="Shipping:" /><br /> 
          <asp:Label ID="lblTotal" runat="server" Text="Total:" /><br /><br /> 
          Click to submit your Purchase Order<br /> 
      <SideBarStyle VerticalAlign="Top" /> 


using System; 
using System.Data; 
using System.Configuration; 
using System.Collections; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Web.UI.HtmlControls; 
    public partial class Checkout : System.Web.UI.Page 
        private Order order; 
        private Customer cust; 
        private ShoppingCart cart; 
        protected void Page_Load(object sender, EventArgs e) 
            cart = (ShoppingCart)Session["cart"]; 
            if (Session["order"] == null) 
                order = new Order(DateTime.Now, 
                    null, (ShoppingCart)Session["cart"]); 
                Session["order"] = order; 
                order = (Order)Session["order"]; 
                cart = order.Cart; 
            cust = new Customer(txtLastName.Text, txtFirstName.Text, txtEmail.Text); 
            order.Cust = cust; 
                = order.SubTotal.ToString("c"); 
                = order.Shipping.ToString("c"); 
                = order.Total.ToString("c"); 
        protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e) 
            bool success = OrderDB.WriteOrder(order); 
            Session["cart"] = null; 
            Session["order"] = null; 
            if (success) 

Any help is appreciated :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.