ASP.NET

Associate
Joined
2 Dec 2006
Posts
71
Hi guys,
Ive been designing a website and been having problems with creating my shooping basket, ive designed and made the shopping cart but have came across this one error for over 2 days now! I was wondering if anyone can see if they know what the problem is and help me. If anyone thinks they can can you add me on msn
 
Last edited:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Units'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Units'.

Source Error:


Line 14: </FooterTemplate>
Line 15: <ItemTemplate>
Line 16: <asp:Label ID="Label7" runat="server" Text='<%# Eval("Units") %>'></asp:Label>
Line 17: </ItemTemplate>
Line 18: </asp:TemplateField>
 
erm ive added the code but more problems seem to happening now it doesnt like the SQL statements, is there any chacne i could send u my project and you have a look at it please, the help would be much appreciated. Ive had this problem for over 2 days no its so frustrating!
 
these errors come up , but i havent edited m web config yet as i do not know what u mean?


C:\Documents and Settings\jak\Desktop\JacksPosterShop\Basket.ascx.cs(26,35): warning CS0618: 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings'
C:\Documents and Settings\jak\Desktop\JacksPosterShop\Basket.ascx.cs(32,9): error CS0127: Since 'Basket.GridView1_OnRowCreated(object, System.Web.UI.WebControls.GridViewRowEventArgs)' returns void, a return keyword must not be followed by an object expression
C:\Documents and Settings\jak\Desktop\JacksPosterShop\Basket.ascx.cs(36,29): error CS0103: The name 'SoftList' does not exist in the current context
Validation Complete
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
 
just the one error now mate :D got to love the programming lol

Validating Web Site
Building directory '/JacksPosterShop/'.

C:\Documents and Settings\jak\Desktop\JacksPosterShop\Basket.ascx.cs(32,9): error CS0127: Since 'Basket.GridView1_OnRowCreated(object, System.Web.UI.WebControls.GridViewRowEventArgs)' returns void, a return keyword must not be followed by an object expression
Validation Complete
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
 
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 Basket : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack && Context.User.Identity.IsAuthenticated)
{
GridView1.DataSource = Profile.Basket;
GridView1.DataBind();
}
}

protected void GridView1_OnRowCreated(object sender, GridViewRowEventArgs e)
{
string connectionString = "ConnectionStrings:ConnectionString";
System.Data.SqlClient.SqlConnection sqlconnection = new System.Data.SqlClient.SqlConnection(connectionString);

System.Data.SqlClient.SqlDataAdapter ad = new System.Data.SqlClient.SqlDataAdapter("SELECT * FROM [posters]", sqlconnection);
DataSet ds = new DataSet();
ad.Fill(ds);
return ds;

DataRow dr = ds.Tables[0].Rows[0];

Label blah = (Label)GridView1.FooterRow.FindControl("Label7");

blah.Text = dr["Units"].ToString();


}

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (Context.User.Identity.IsAuthenticated)
{
TextBox tb =
(TextBox)GridView1.Rows[GridView1.SelectedIndex].Cells[1].Controls[1];
int newval = int.Parse(tb.Text);
Profile.Basket[GridView1.SelectedIndex].Units = newval;
Profile.Save();
GridView1.DataSource = Profile.Basket;
GridView1.DataBind();
}
}
protected void LinkButton1_Click1(object sender, EventArgs e)
{
if (Context.User.Identity.IsAuthenticated)
{
Profile.Basket.Clear();
GridView1.DataBind();
}
}


}
 
ive done that before abd it returns the error i had right from the begginning


DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Units'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Units'.

Source Error:


Line 14: </FooterTemplate>
Line 15: <ItemTemplate>
Line 16: <asp:Label ID="Label7" runat="server" Text='<%# Eval("Units") %>'></asp:Label>
Line 17: </ItemTemplate>
Line 18: </asp:TemplateField>


Source File: c:\Documents and Settings\jak\Desktop\JacksPosterShop\Basket.ascx Line: 16
 
Back
Top Bottom