Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Button show all results. View modes: 
User avatar
Member
Member
Leandro Brito - 9/28/2011 10:11:46 PM
   
Button show all results.
Hi,

How to do a button after repeater using updatepanel to show all results?

The repeater os events show 10 items on page Events.aspx, below I have a button called "show all", and when the user clicks on button, the repeater needs show all events.

Is necessary to use macro or something like that?

Thanks

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 10/3/2011 2:18:22 AM
   
RE:Button show all results.
Hello,

Your aim is achievable via the Repeater web part customization.

Firstly, I would recommend you to clone your current Repeater web part and then work with that cloned one. You can amend the Repeater's code file like this:


<asp:UpdatePanel ID="updPanel" runat="server">
<ContentTemplate>

<asp:Button ID="btnShowAll" runat="server" Text="Show all" OnClick="btnShowAll_Click" />

<cms:CMSRepeater ID="repItems" runat="server" TopN="5" />

</ContentTemplate>
</asp:UpdatePanel>


And, as a second step, you'll define the btnShowAll_Click method in the code-behind:

    protected void btnShowAll_Click(object sender, EventArgs e)
{
repItems.TopN = 0;
repItems.ReloadData(true);
}


This way you'll be able to show all results on a button click.

Please consider the code above to be just an example and feel free to adjust it as per your needs.

Best regards
Ondrej Vasil

User avatar
Member
Member
Leandro Brito - 11/28/2011 11:32:01 AM
   
RE:Button show all results.
Hi,

I'm trying do this solution to Image attachment gallery, but the structure is different. The gallery use other user controls and basic repeater, that doesn't has TopN property.

How to do the button "show more images" for the gallery?

Thanks.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/6/2011 2:32:15 AM
   
RE:Button show all results.
Hello,

The given web part uses the CMSModules\Content\Controls\Attachments\DocumentAttachments\DocumentAttachments.ascx control. There is also the basic repeater used. If you want to use the TopN property, you will have to change the mentioned control or create one by your own. Please note, that modifying standard controls may cause problems in other parts of the CMS if done incorrectly. YOu can also lose the changes during upgrade.
Additionally, you will have to check the AttachmentsDataSource control, if all the images are available, or if they are selected by some inner condition and change the behavior of the datasource according to your needs. I would suggest you to run the site in debug mode to find out more about it's behavior.

Best regards,
Boris Pocatko

User avatar
Member
Member
Leandro Brito - 12/6/2011 5:24:58 AM
   
RE:Button show all results.
Thanks for the answer.

I did a simple jquery to hide and show the images using fadeIn and fadeOut. I think this solution works fine in this situation for me because the maximun number of images is low.