Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > number of photos in lightbox or image gallery View modes: 
User avatar
Member
Member
gary.chan-e-crusade - 7/3/2009 12:03:50 AM
   
number of photos in lightbox or image gallery
Hi,

Any variables from lightbox and imagegallery can return number of photos inside the repeater?

e.g. eval("noofphotos")

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 7/5/2009 1:54:45 PM
   
RE:number of photos in lightbox or image gallery
Hi Gary,

Unfortunately, there is no such a variable. But you could add some asp:Literal control into transformation and write custom code-behind to get the DataSet of repeater and set the number of rows of DataSet to Text property of Literal in order to display it in transformation.

Best Regards,

Martin Dobsicek

User avatar
Member
Member
gary.chan-e-crusade - 7/5/2009 9:18:54 PM
   
RE:number of photos in lightbox or image gallery
Thanks for the suggestion

As it is not easy for create customized function in kentico cms, can you advices the below in detail:

1. how to add some asp:literal control into transformation?
2. how to write the custom code-behind the get the dataset of repeater?
3. why and how to set the number of rows of dataset to text property of literal?


User avatar
Kentico Developer
Kentico Developer
kentico_martind - 7/12/2009 2:28:23 PM
   
RE:number of photos in lightbox or image gallery
Hi Gary,

I've realized that using procedure I suggested the count would be displayed for every item in the list. I suppose you want to display it only once on page. If so, could you please try if procedure described in How to display number of records of repeater article suits your needs?

Best Regards,

Martin Dobsicek

User avatar
Member
Member
gary.chan-e-crusade - 7/13/2009 9:25:30 PM
   
RE:number of photos in lightbox or image gallery
thanks for suggestion,

I have followed the procedure :
1) add ltlRepeaterCount to CMS Desk --> Development --> Listings and Viewers --> repeater_promotion
2) add the code

There are errors occured.

[Error loading the WebPart 'repeater_promotion']
c:\mh.e-crusade.com\CMSWebParts\Viewers\cmsrepeater_promo.ascx.cs(778): error CS0103: The name 'ltlRepeaterCount' does not exist in the current context


Can you explain the procedure adding add asp:Literal control with ID = "ltlRepeaterCount" and how can i display the count of repeated item into transformation?

Thanks

User avatar
Member
Member
gary.chan-e-crusade - 7/15/2009 8:59:30 PM
   
RE:number of photos in lightbox or image gallery
Hi,

I have add the :
<asp:Literal ID="ltlRepeaterCount" runat="server"></asp:Literal>
into ascx file.

and change the code in new repeater webpart.

However, the repeater doesn't show anythings but none of error.
Also, how to show the number of items looped by repeater?

Please advices.

Thanks

User avatar
Member
Member
gary.chan-e-crusade - 7/19/2009 10:16:06 PM
   
RE:number of photos in lightbox or image gallery
Hi,

finally i can use the coding to display number of item in repeater.

However, I don't know how to put the output number (which display at the left corner of repeater) into my transformation.

Please advices.


Thanks

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/20/2009 7:38:40 AM
   
RE:number of photos in lightbox or image gallery
Hi Gary,

I would recommend you to style the Literal (using CSS styles) and place it where you need it. The Transformation would display the number of rows in each data row so I think it is not useful in your case.

Best regards,
Helena Grulichova

User avatar
Member
Member
gary.chan-e-crusade - 7/20/2009 8:55:23 PM
   
RE:number of photos in lightbox or image gallery
Hi ,

please advice how to style the literal using css styles in details?

using visual studio or cms?

thanks

User avatar
Member
Member
kentico_pavelk - 7/21/2009 7:10:45 AM
   
RE:number of photos in lightbox or image gallery
Hi,

You can surround the literal with span tag and use class attribute to specify the CSS class name. Please find an example below.

<span class="your class">
<asp:Literal runat="server" ID="literal1" Text="some text"/>
</span>


Where your class is name of CSS class that you may need to specify in your CSS. You can find more details about CSS stylesheets in our Developer's guide:
http://devnet.kentico.com/docs/devguide/index.html?css_overview.htm


Best Regards,
Pavel Knotek

User avatar
Member
Member
gary.chan-e-crusade - 7/21/2009 7:18:34 AM
   
RE:number of photos in lightbox or image gallery
Thanks

However, If i would like to show the subpage 's repeater count, how can i get the value?

e.g.

current page (display the repeater count of a)-
subpage (repeater a)

Please advices

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/21/2009 9:37:18 AM
   
RE:number of photos in lightbox or image gallery
Hi Gary,

If you would like to hide the repeater and show only the number of records you could add a PreRender event to your repItems repeater in your custom control:

<cms:CMSRepeater ID="repItems" runat="server" EnableViewState="true" OnPreRender="repItems_PreRender" />


and then add this code to your code behind:

protected void repItems_PreRender(object sender, EventArgs e)
{
this.repItems.Visible = false;
}


You may play with conditions to achieve your requested behavior.

Best regards,
Helena Grulichova