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");
}
}
}
|