如何在更新面板中更新两个数据列表 [英] How update two datalists in Update Panel
问题描述
嘿伙计们,
我有两个数据主义者,第一个显示我的画廊列表,第二个显示该画廊的图像。因为这是一个单页设计,我想通过点击一个按钮(图库画家数据库中的每个项目可用)为每个画廊加载图像
我一直在阅读触发器和AsyncPostBackTrigger但尚未成功使它工作!:(((
我想通过单击该项目的ShowItems按钮来加载每个图库的图像在画廊datalist。
第一个
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: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: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
推荐答案
点击正常加载初始图库。然后,在用户单击一个特定图库时,获取该图库的图像。您需要将gallery-id(或者您将画廊区分开来)放入按钮CommandArgument。
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.
这篇关于如何在更新面板中更新两个数据列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!