Invalid Operation Exception when I try to look at cart

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
jpopowski1
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 40
Joined: Wed Oct 01, 2008 10:10 am

Invalid Operation Exception when I try to look at cart

Post by jpopowski1 » Mon Jun 15, 2009 3:17 pm

I am trying to create a new website with customization by copying an old one.

I put AC demo copy on the machine. Then copied the 'Custom' folders that were created for original site because the new site we will be setting up will first be a mirror image of the production site and then get modified..

Navigating thru the products work fine. However, I cannot add to cart. (Add to cart button on the Product Page actually goes to the basket page, but in the rendering the page I get the error shown in the stack trace.
It seems that the Basket.ascx (which has NOT been modified by us) wants the product to have assets computed, but they aren't, so Product.NavigateURL is undefined. I downloaded the hot patch for 7.0.3, but this problem persists.

My questions are:
1. Have you encountered this before? (Trying to determine if our modifications to the product page caused it or if it is an AC problem.)
2. Can you offer me any clues? I've been looking at this a couple of days, and cannot see even in the 7.02 code used at the production site where that NavigateURL is set up, tho I suspect it's during the instantiation of the Basket Item. Any help would be greatly appreciated.
[InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.]
System.Web.UI.Page.GetDataItem() +2647882
System.Web.UI.TemplateControl.Eval(String expression) +31
ASP.conlib_basket_ascx.__DataBinding__control11(Object sender, EventArgs e) in c:\AC\ConLib\Basket.ascx:34
System.Web.UI.Control.OnDataBinding(EventArgs e) +99
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +92
System.Web.UI.Control.DataBind() +15
System.Web.UI.Control.DataBindChildren() +211
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
System.Web.UI.Control.DataBind() +15
System.Web.UI.Control.DataBindChildren() +211
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
System.Web.UI.Control.DataBind() +15
System.Web.UI.Control.DataBindChildren() +211
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
System.Web.UI.Control.DataBind() +15
System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +155
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +2417
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +14
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.GridView.DataBind() +4
ConLib_Basket.BindBasketGrid() in c:\AC\ConLib\Basket.ascx.cs:55
ConLib_Basket.Page_PreRender(Object sender, EventArgs e) in c:\AC\ConLib\Basket.ascx.cs:264
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnPreRender(EventArgs e) +8679510
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.WebControls.WebParts.WebPart.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

jpopowski1
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 40
Joined: Wed Oct 01, 2008 10:10 am

Re: Invalid Operation Exception when I try to look at cart

Post by jpopowski1 » Mon Jun 15, 2009 9:13 pm

I have gotten past this error by changing the
Eval("Quantity") references in the Basket.aspx to this form
((BasketItem)Container.DataItem).Quantity

Is there a setting somewhere that allows the use of Eval("Quantity") instead?
This was not an issue in 7.0, but has popped up with the 7.0.3 installation.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Invalid Operation Exception when I try to look at cart

Post by mazhar » Tue Jun 16, 2009 5:09 am

Basket page in 7.0.3 is working fine, it may be due to customized work. When moving old customizations to new ones there could be chances of code breaks due to updates in back end.

jpopowski1
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 40
Joined: Wed Oct 01, 2008 10:10 am

Re: Invalid Operation Exception when I try to look at cart

Post by jpopowski1 » Tue Jun 16, 2009 9:59 am

Is there a setting which allows the Eval("Quantity") construct?

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Invalid Operation Exception when I try to look at cart

Post by mazhar » Tue Jun 16, 2009 10:07 am

We are imposing no setting, its something available in .NET. All that is needed is that you are using some control which binds to some collection object.

Post Reply