Page 1 of 1
Description on Category Grid Page
Posted: Fri Jun 26, 2009 2:01 pm
by Ben
What is the best way to get my summary or description on to the Category Grid Page layout? I tried this in the .ascx but didn't work.
Code: Select all
<asp:Literal ID="CategoryDescription" runat="server" EnableViewState="false"></asp:Literal>
The Category Details Page adds my summary/description but doesnt give me a 3 column option. I would be willing to use Category Details Page if I could make it into 3 columns. Thanks
Re: Description on Category Grid Page
Posted: Fri Jun 26, 2009 2:07 pm
by mwolf
I actually just did this on CategoryGridPage today.
CategoryGridPage.ascx (add this code wherever you want the description to display)
Code: Select all
<div style="text-align:center; padding:8px;">
<asp:Literal ID="CategoryDescription" runat="server"></asp:Literal>
</div>
CategoryGridPage.ascx.cs (change BindPage() function)
Original Code:
Code: Select all
private void BindPage()
{
//BIND THE DISPLAY ELEMENTS
if (IsValidCategory())
{
CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
CategoryBreadCrumbs1.CategoryId = this.CategoryId;
if (_Category != null)
{
Page.Title = _Category.Name;
//Caption.Text = _Category.Name;
}
else
{
// IF IT IS ROOT CATEGORY
Page.Title = DefaultCaption;
//Caption.Text = DefaultCaption;
}
BindSubCategories();
}
else
{
CategoryHeaderPanel.Visible = false;
}
BindSearchResultsPanel();
}
CHANGE BindPage() To:
Code: Select all
private void BindPage()
{
//BIND THE DISPLAY ELEMENTS
if (IsValidCategory())
{
CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
CategoryBreadCrumbs1.CategoryId = this.CategoryId;
if (_Category != null)
{
Page.Title = _Category.Name;
CategoryDescription.Text = _Category.Description;
//Caption.Text = _Category.Name;
}
else
{
// IF IT IS ROOT CATEGORY
Page.Title = DefaultCaption;
//Caption.Text = DefaultCaption;
}
BindSubCategories();
}
else
{
CategoryHeaderPanel.Visible = false;
}
BindSearchResultsPanel();
}
Re: Description on Category Grid Page
Posted: Tue Dec 14, 2010 12:59 pm
by kens
Hi all-
I tried this solution on a customcategorygridpage that I have and it worked fine (I usedd cdesc.text instead of Categorydescription.text). I tried the same code on the regular categorygrid page and it gave me the following error:
cdesc does not exist in the current context
any ideas why it would work in one and not the other?
Thanks
Ken
Re: Description on Category Grid Page
Posted: Wed Dec 15, 2010 6:02 am
by s_ismail
I guess you are missing literal control with id 'cdesc' in your customcategorygridpage.ascx file. If you want to use literal with id 'cdeskc' then you must have a literal control instead of Categorydescription literal
LIke this one
Code: Select all
<asp:Literal ID="cdesc" runat="server"></asp:Literal>
Re: Description on Category Grid Page
Posted: Tue Dec 21, 2010 8:27 am
by kens
Almost forgot to come back and say thanks.
It never even occurred to me that I HAD to reference it in ascx page in order to not get an error. I had assumed (rotten me) that step 1 was to set it up in cs file and step 2 was put it in the ascx file and that it wouldn't be a problem.
I have a lot to learn!
Thanks
Ken