Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hey Guys,
I have got two datalists the fist one shows the list of my galleries and the second one shows the images of that gallery. since this is a one page design i want to load images for each gallery by clicking a botton (available for each item in the gallery datalist)

I ve been reading about triggers and AsyncPostBackTriggerbut haven't been abale to make it work !:(((

I want to load the images for each gallery by clicking the ShowItems button for that item in the gallery datalist.

The fist one

ASP.NET
    <asp:Panel runat="server" ID="PanelShowGallery">
        <asp:DataList ID="DataListImageGallery" runat="server" OnItemDataBound="DataListImageGallery_ItemDataBound" RepeatColumns="4" OnItemCommand="DataListImageGallery_ItemCommand">
            <ItemTemplate>
                <div id="GalleryList" style="text-align: center; padding: 5px;">
                    <asp:HiddenField ID="HiddenFieldValue" Value='<%# Eval("gId") %>' Visible="false" runat="server" />
                    <asp:Image ID="ImageGallery" runat="server" ToolTip='<%# Eval("gTitle") %>' Style="border: 2px solid silver; padding: 5px; background-color: #1c28b5;" />
                    <div style="color: Black; padding: 0px; margin-removed 0px; border: 2px solid silver; background-color: #f0f0f0; width: 100px; margin: 0 auto; min-height: 22px; height: auto; border-top-style: none; font-size: x-small; font-family: Tahoma;">
                        <%# Eval("gTitle") %>
                    </div>
                    <asp:Button runat="server" ID="ShowItems" CommandArgument='<%# Eval("gId") %>' CommandName="ShowItems" Text="ShowImages" />
                </div>
            </ItemTemplate>
        </asp:DataList>
    </asp:Panel>
</ContentTemplate>


The Second one

ASP.NET
<asp:DataList runat="server" ID="DataListImages" CellPadding="10" RepeatDirection="Horizontal">
                        <ItemTemplate>
                            <div class="Images">
                                <a href='<%# Eval("LPicture.Virtual_FileName") %>' title='<%# Eval("giTitle") %>'>
                                    <asp:Image ImageUrl='<%# Bind("SPicture.Virtual_FileName")%>' runat="server" BorderStyle="None"
                                        ID="ImageThumb" ToolTip='<%# Eval("giDescription") %>' />
                                </a>
                            </div>
                        </ItemTemplate>
                    </asp:DataList>


I'd appreciate any help
Thank you
Posted
Comments
Sinisa Hajnal 5-Sep-14 1:22am    
Asyncpostback is a property of UpdatePanel, not Panel.

1 solution

Load the initial gallery normally on click. Then, upon user clicking one particular gallery, get image for that gallery. You need to put gallery-id (or however you differentiate the galleries) into button CommandArgument.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900