Page 1 of 1

Adding Category Description to CategoryGridPage

Posted: Mon Sep 15, 2014 3:09 pm
by webmaz
I'm trying to customize the CategoryGridPage to include the category description.
I have tried using code from CategoryGridPage4 and code from this forum post: viewtopic.php?f=42&t=17583&p=75683 but neither option has worked.

I receive the error:
[[ConLib:CategoryGridPage]] CategoryGridPage.ascx.cs(100): error CS0103: The name '_Category' does not exist in the current context

I've tried several different variations and nothing works.
I am not a programmer. Could someone point me in the right direction?

Right now the code behind file contains:

Code: Select all

       private void BindPage()
        {	
            //BIND THE DISPLAY ELEMENTS
            if (IsValidCategory())
            {
                CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
                CategoryBreadCrumbs1.CategoryId = this._categoryId;
                if (_category != null)
                {
                    Page.Title = string.IsNullOrEmpty(_category.Title) ? _category.Name : _category.Title; 
                    Caption.Text = _category.Name;
				
				//Added for category description
				if (!string.IsNullOrEmpty(_Category.Description))
				{
				CategoryDescriptionPanel.Visible = true;
				CategoryDescription.Text = _Category.Description;
				}
				else CategoryDescriptionPanel.Visible = false;
				//END category description
				
                }
                else
                {
                    // IF IT IS ROOT CATEGORY
                    Page.Title = DefaultCaption;
                    Caption.Text = DefaultCaption;
                }
				
                BindSubCategories();
            }
            else
            {
                CategoryHeaderPanel.Visible = false;
            }

            BindSearchResultsPanel();
        }

Re: Adding Category Description to CategoryGridPage

Posted: Tue Sep 16, 2014 12:44 am
by mazhar
CategoryGridPage lists sub categories in top. You are wanting to show description in there?

Re: Adding Category Description to CategoryGridPage

Posted: Tue Sep 16, 2014 1:24 am
by jmestep
It looks like it would work with a small c
if (_category != null)
{
.......

if (!string.IsNullOrEmpty(_category.Description))
{
CategoryDescriptionPanel.Visible = true;
CategoryDescription.Text = _category.Description;
}
C# is case sensitive.