زمانی که بر روی دکمه add to cart کلیک می کنم ارور زیر رو می ده
Object reference not set to an instance of an object.
کد استفاده شده
protected void CartGrid_RowUpdated(object sender, GridViewUpdatedEventArgs 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();
}
e.RowIndex اینو نمیشناسه
اینم متذکر بشم که تو برنامه ای که برای شما گذاشتم به جای e.RowIndex عدد 5 نوشته شده که اشتباه هستش لطفا به جای 5 ،e.RowIndex رو تایپ کنید .
اما مشکل حل نمی شه ایا nameSpace خاصی باید اضافه کرد تا e.RowIndex بشناسه؟؟؟؟