CategoryGridPage3.ascx

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
laramp
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 36
Joined: Tue Jul 25, 2006 1:01 pm

CategoryGridPage3.ascx

Post by laramp » Thu Dec 06, 2007 2:04 am

This template is throwing errors. It has not been modified at all.
I am placing it on the home page.
[[ConLib:CategoryGridPage3]]

Is anyone else getting this...

Server Error in '/' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:


Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
ConLib_CategoryGridPage3.BindPagingControls() +156
ConLib_CategoryGridPage3.BindSearchResultsPanel() +77
ConLib_CategoryGridPage3.BindPage() +124
ConLib_CategoryGridPage3.Page_PreRender(Object sender, EventArgs e) +30
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnPreRender(EventArgs e) +2114636
System.Web.UI.Control.PreRenderRecursiveInternal() +77
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.WebControls.WebParts.WebPart.PreRenderRecursiveInternal() +62
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360


Is there a fix for it?

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Post by AbleMods » Thu Dec 06, 2007 7:55 am

Can you put a categorygrid user control on just any page?

I've never tried it, but I know the category.aspx pages have code-behind in them. It might be that the user control requires that code-behind.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Post by jmestep » Thu Dec 06, 2007 8:06 am

I think Joe has the answer- I think it needs to have a category Id passed to it:
public int CategoryId
{
get
{
if (ViewState["CategoryId"] == null)
ViewState["CategoryId"] = PageHelper.GetCategoryId();
return (int)ViewState["CategoryId"];
}
set
{
ViewState["CategoryId"] = value;
}
}

You might be able to work around it by using a category display page for your home page, using a top level category.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
laramp
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 36
Joined: Tue Jul 25, 2006 1:01 pm

Post by laramp » Thu Dec 06, 2007 10:13 am

Thank you for your responses....

The file(code-behind - CategoryGridPage3.ascx.cs) has that code already in it....excuse me for my ignorance in this .... This version is all new to me and I am just getting this figured out.

Any other answers or testing would be greatly appreciated.

LR

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Post by jmestep » Thu Dec 06, 2007 10:17 am

I got that code from the code behind. What I was trying to say that if you are on the home page, there is probably no category id for it to pull from.
This is all new to me also, so I'm just guessing. Try defining a category id here temporarily instead of getting it from ViewState
ViewState["CategoryId"] = value;
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Post by sohaib » Thu Dec 06, 2007 10:20 am

Probably the controls need to be updated so that in case required parameter is missing they don't crash but instead show some friendly message.

User avatar
laramp
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 36
Joined: Tue Jul 25, 2006 1:01 pm

Post by laramp » Thu Dec 06, 2007 11:45 am

Well The error is gone but no categories show up.

I will just keep trying tofigure it out...if there are any other ideas I would sure love to hear em!

Thanks,
LR

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Post by jmestep » Thu Dec 06, 2007 11:47 am

I think no categories show up because there are no categories on the home page- it doesn't have a categoryid.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

herchenx
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 28
Joined: Mon Sep 24, 2007 4:10 pm
Location: Fort Collins, CO

Post by herchenx » Thu Dec 06, 2007 1:20 pm

sohaibATablecommerce is right. I put some try{}catch{} blocks around the offending code and it keeps the nasty errors off the page, but any of the controls that need a categoryID won't work on the default home page. (since as others have pointed out the home page is not in a category.)

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Post by AbleMods » Thu Dec 06, 2007 4:57 pm

The categorygrid control is designed to be used from a call to particular category. The home page doesn't make such a call. Therefore the control has no starting point and has nothing to render. Technically the error is legitimate as the control is not being used as it is designed.

We could probably help you much better if we knew your goal.

If you're wanting to put a particular category of products directly on your home page, that will require a customized categorygrid control hardcoded to the categoryid you want to display.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
laramp
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 36
Joined: Tue Jul 25, 2006 1:01 pm

Post by laramp » Fri Dec 07, 2007 2:53 pm

Yes, I realize that....My goal is to have a dynamic generation of top level categories with thumbnails displayed in 2 or 3 columns in the content area.
I can set it up static or use featured items at this point until I write something that will work. I just wanted to use what was already available.

No worries,
LR

Post Reply