Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 24th, 2006, 06:05 PM
Authorized User
 
Join Date: Jul 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Build Errors..Not Sure What to Do??

Hello and thank you for taking a moment to read this message. I am trying to build a shopping cart application in asp.net using C#. The cart will use Session variables and arrays to populate the shopping cart.I create an ArrayList for storing the selected products.I also test for any previously stored session variables. A new shopping cart item is created with a c# class I have sitting in my App_Code folder.Right now I am getting weird build error. I am new to asp.net 2.0 so forgive me if some of this seems obvious. I thnk you you in advance for any help you can offer. Below are my errors and my codebehind.- Jason


Error 1 'ASP.productcatalog_aspx.SupportAutoEvents': no suitable method found to override c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\website8\cd78ec04\fe0c014\App_Web_ccwcxlb3.0 .cs

Error 2 'ASP.productcatalog_aspx.GetTypeHashCode()': no suitable method found to override c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\website8\cd78ec04\fe0c014\App_Web_ccwcxlb3.0 .cs

Error 3 'ASP.productcatalog_aspx.ProcessRequest(System.Web .HttpContext)': no suitable method found to override c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\website8\cd78ec04\fe0c014\App_Web_ccwcxlb3.0 .cs

Error 4 'ASP.productcatalog_aspx' does not implement interface member 'System.Web.IHttpHandler.IsReusable' c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\website8\cd78ec04\fe0c014\App_Web_ccwcxlb3.0 .cs

Error 5 Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl). C:\Documents and Settings\Jason Livengood\My Documents\Visual Studio 2005\WebSites\WebSite8\productcatalog.aspx.cs 1 33 C:\...\WebSite8---------------------------------------------------------------------

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace ShoppingCartCookies
{
    public class Webform1 : System.Web.UI.Page

    {
        protected System.Web.UI.WebControls.Button Button1;
        protected System.Web.UI.WebControls.DataGrid DataGrid1;

        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindGrid();
            }
        }


        private void BindGrid()
        {
            SqlDataAdapter da = new SqlDataAdapter("select * from products", @"data source=.\vsdotnet;initial catalog=northwind;user id=sa");
            DataSet ds = new DataSet();
            da.Fill(ds, "products");

            DataGrid1.DataSource = ds;
            DataGrid1.DataBind();
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.DataGrid1.SelectedIndexChanged += new System.EventHandler(this.DataGrid1_SelectedIndexCh anged);
            this.Button1.Click += new System.EventHandler(this.Button1_Click);
            this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion

        private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            ArrayList arr;
            if (Session["mycart"] != null)
            {
                arr = (ArrayList)Session["mycart"];
            }
            else
            {
                arr = new ArrayList();
                Session["mycart"] = arr;
            }

            CShoppingCartItem item = new CShoppingCartItem();
            item.ProductID = int.Parse(DataGrid1.SelectedItem.Cells[1].Text);
            item.ProductName = DataGrid1.SelectedItem.Cells[2].Text;
            item.UnitPrice = decimal.Parse(DataGrid1.SelectedItem.Cells[3].Text);
            item.Quantity = 1;
            arr.Add(item);
        }

        private void Button1_Click(object sender, System.EventArgs e)
        {
            Response.Redirect("cart.aspx");
        }
    }
}










 
Old September 26th, 2006, 10:59 PM
Registered User
 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to givenscj
Default

You have to get rid of your namespace declaration!

CJG

 
Old March 8th, 2007, 02:24 PM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have the same problem but the cs file does not have any namespace clause.

Help?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird Build Errors Aaron Edwards ASP.NET 2.0 Basics 1 November 2nd, 2007 03:04 AM
VC++ Build Errors, Help!!!!!!!!! gothicpurple Visual C++ 0 August 29th, 2006 06:35 PM
build errors in vc++ angel188 Visual C++ 0 June 6th, 2006 06:41 AM
ThePhile 113 Build Errors eureka BOOK: ASP.NET Website Programming Problem-Design-Solution 4 September 27th, 2005 01:39 PM
Please Help! Build errors motsam BOOK: ASP.NET Website Programming Problem-Design-Solution 2 February 29th, 2004 10:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.