PDA

View Full Version : سوال: دلیل بروز خطای HttpException was unHanhled by user code چیست؟



IT-love
یک شنبه 13 شهریور 1390, 08:58 صبح
سلام دوستان

من دارم یه فروشگاه طراحی میکنم اما وقتی روی مشاهده کارت خرید کلیلک میکنم این خطا رو میده : HttpException was unHanhled by user code
Afield or property with the name "total" was not found on selected data source

کدی که نوشتم اینه به نظر شما کجا رو غلط نوشتم یا ایراد کارم چیه؟
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ShoppingControlCart : System.Web.UI.UserControl
{

private void BindGrid()
{
CartGrid.DataSource = Profile.Cart.items;
DataBind();
Label1.Text = String.Format("Total:{0,19:c}", Profile.Cart.Total);
}
protected void Page_Load(object sender, EventArgs e)
{
if (Profile.Cart == null)
Profile.Cart = new rayaneh.commerce.ShoppingCart();
if (!Page.IsPostBack)
BindGrid();
if (Profile.Cart.items.Count == 0)
Label1.Visible = false;
}
protected void CartGrid_RowEditing(object sender, GridViewEditEventArgs e)
{
CartGrid.EditIndex = e.NewEditIndex;
BindGrid();
}
protected void CartGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
TextBox quantityTextBox = (TextBox)CartGrid.Rows[e.RowIndex].Cells[2].Controls[0];
int quantity = System.Convert.ToInt32(quantityTextBox.Text);
if (quantity == 0)
Profile.Cart.items.RemoveAt(e.RowIndex);
else
Profile.Cart.items[e.RowIndex].quantity = quantity;
CartGrid.EditIndex = -1;
BindGrid();
}
protected void CartGrid_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
CartGrid.EditIndex = -1;
BindGrid();
}
protected void CartGrid_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
Profile.Cart.items.RemoveAt(e.RowIndex);
BindGrid();
}
}


از این قسمت ایراد میگیره:


private void BindGrid()
{
CartGrid.DataSource = Profile.Cart.items;
DataBind();
Label1.Text = String.Format("Total:{0,19:c}", Profile.Cart.Total);
}

IT-love
یک شنبه 13 شهریور 1390, 17:21 عصر
متخصصین عزیز یعنی واقعا کسی نیست که چاره مشکل منو بدونه؟ من خیلی عجله دارم لطفا کمک کنید.:افسرده: