shopping cart editing problemer
ok jeg har fulgt bogen men der opstod en masse fejl og det kode programmet (visual studio) laver stemmer heller ikke helt overens med det i bogen...min kode ser således ud:
<script runat="server">
Protected Sub CartGrid_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs)
{
CartGrid.EditIndex = e.NewEditIndex;
BindGrid();
}
End Sub
Protected Sub CartGrid_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs)
{
TextBox QuantityTextBox = (TextBox)CartGrid.Rows[e.RowIndex.Cells[2].Controls[0];
Int Quantity = Convert.ToInt32(QuantityTextBox.Text);
if (Quantity == 0)
{
Profile.Cart.Items.RemoveAt(e.RowIndex);
}
Else
{
Profile.Cart.Items[e.RowsIndex].Quantity = Quantity;
}
CartGrid.EditIndex = -1;
BindGrid();
}
End Sub
Protected Sub CartGrid_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs)
{
CartGrid.EditIndex = -1;
BindGrid();
}
End Sub
Protected Sub CartGrid_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs)
{
Profile.Cart.Items.RemoveAt(e.RowIndex);
BindGrid();
}
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
if (Profile.Cart ==null)
{
Profile.Cart = new Wrox.Commerce.ShoppingCart();
}
If (!Page.IsPostBack) Then
{
BindGrid();
}
if (Profile.Cart.Items == null)
{
TotalLabel.Visible = false;
}
}
End Sub
</script>
hvis nogen kan lave magi så bliver jeg glad og giver en kæ,pe belønning :P
imens tager jeg hjem og plejer min hovedpine som det her efter hånden har givet mig :P