Page 1 of 1
ProductAccessoriesGrid
Posted: Tue Mar 02, 2010 3:16 pm
by gardnerr
Hi AbleCommerce,
The following two lines of code in ProductAccessoriesGrid.ascx.cs are causing a null ref exception:
HyperLink addToCartLink = PageHelper.RecursiveFindControl(e.Item, "BuyNowLink") as HyperLink;
addToCartLink.Visible = false;
This happens when one of the products in the accessories grid has had purchasing disabled. The add to cart button is disabled in AddToCartLink.ascx.cs so is this code necessary?
Regards
Rob
Re: ProductAccessoriesGrid
Posted: Wed Mar 03, 2010 6:58 am
by mazhar
Give a try update above two lines of code with these lines, hopefully it will fix it.
Code: Select all
Control control = PageHelper.RecursiveFindControl(e.Item, "BuyNowLink");
if(control != null)
{
HyperLink addToCartLink = control as HyperLink;
addToCartLink.Visible = false;
}
Re: ProductAccessoriesGrid
Posted: Sat Mar 06, 2010 5:28 am
by gardnerr
Hi,
Could anyone from Able please tell me why, when an exception was thrown on this line, it was not logged either in the db or log file?
Thanks
Rob
Re: ProductAccessoriesGrid
Posted: Sat Mar 06, 2010 9:41 am
by mazhar
I just looked into that, global error loging is happening in Global.asax file's
Application_Error event handler. Here we have a code statement ignoring the HTTP exceptions, seems like its to reduce the size of log information because people can type wrong URLs etc and loging all that information may take valuable space. In current case if null exception is being thrown by some code HTTP exception check returns instead of logging the issue because its of type HttpUnhanderledException. I am not sure its intentional for this sort of exceptions or not. Anyhow I am going to open a new bug for this.
http://bugs.ablecommerce.com/show_bug.cgi?id=8784
For you workaround you can simply comment out following line in Global.asax, locate following statement
Code: Select all
if (exception is HttpException) return;
and change it as below
Code: Select all
//if (exception is HttpException) return;
Re: ProductAccessoriesGrid
Posted: Mon Mar 08, 2010 1:20 pm
by gardnerr
Hi Mazhar,
Thanks for the reply. As a follow-on from this, I am currently getting the dreaded Invalid Viewstate error on my site. This obviously doesn't normally get logged as it is filtered out in Application_Error. However, I am seeing '/Errors/GeneralError.aspx?aspxerrorpath=/ScriptResource.axd' in my page tracking history every time this happens.
After much research on the Web, I am still unable to reproduce the error, and more importantly, I am unable to tell whether the user does actually see GeneralError.aspx. As the problem could be AJAX related it could be an async call that is getting the error page.
I'd appreciate it if you could clarify whether you believe the user will be seeing the error page. If not, should this be logged in page history?
Thanks
Rob
Re: ProductAccessoriesGrid
Posted: Wed Mar 10, 2010 6:58 am
by mazhar
Please have a look at following thread
viewtopic.php?f=42&t=12541