Page 1 of 1

Error on Basket Page

Posted: Wed Oct 08, 2014 10:52 am
by webmaz
I noticed an error in my error logs related to the basket page. It seems like it could be easy to fix, but I'm new to C#.
Any insights?

An error has occured at http://www.website.com/Basket.aspx
Exception: Exception of type 'System.Web.HttpUnhandledException' was thrown. Stack Trace: at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.basket_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Inner Exception: An error has occurred because a control with id 'ctl00$ctl00$NestedMaster$PageContent$CheckoutButton' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error. Inner Exception Stack Trace: at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Re: Error on Basket Page

Posted: Wed Oct 08, 2014 1:30 pm
by Katie
An error has occurred because a control with id 'ctl00$ctl00$NestedMaster$PageContent$CheckoutButton' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.
Have you made any customizations to this page?

Re: Error on Basket Page

Posted: Wed Oct 08, 2014 1:54 pm
by webmaz
There is second checkout button.

Partial code is below.

Designer:

Code: Select all

<asp:LinkButton ID="CheckoutButtonNew" runat="server" OnClick="CheckoutButton_Click" Text="Checkout >>" EnableViewState="false" CssClass="checkoutbutton"></asp:LinkButton>
...
<asp:LinkButton ID="CheckoutButton" runat="server" OnClick="CheckoutButton_Click" Text="Checkout >>" EnableViewState="false" CssClass="checkoutbutton"></asp:LinkButton>
Code Behind:

Code: Select all

        protected void BasketGrid_DataBound(object sender, EventArgs e)
        {
            if (BasketGrid.Rows.Count > 0)
            {
                CheckoutButton.Visible = !AbleContext.Current.Store.Settings.ProductPurchasingDisabled;
				CheckoutButtonNew.Visible = !AbleContext.Current.Store.Settings.ProductPurchasingDisabled;
                ClearBasketButton.Visible = true;
                UpdateButton.Visible = true;
                EmptyBasketPanel.Visible = false;
                ValidateOrderMinMaxAmounts();
            }
            else
            {
                CheckoutButton.Visible = false;
				CheckoutButtonNew.Visible = false;
                ClearBasketButton.Visible = false;
                UpdateButton.Visible = false;
                OrderAboveMaximumAmountMessage.Visible = false;
                OrderBelowMinimumAmountMessage.Visible = false;
                EmptyBasketPanel.Visible = true;
            }
        }