我在RadListView中添加了从数据库源读取的ASP.NET图像按钮,并将图像输出到RadListView。我的问题是我无法从RadButton中选择图片到图像。
<asp:Image ID="Image1" runat="server" Width="300px" />
<br />
<telerik:RadListView ID="RadListView3" runat="server" AllowPaging="True"
onselectedindexchanged="RadListView3_SelectedIndexChanged"
OnItemDataBound="RadListView3_ItemDataBound" PageSize="4"
AllowCustomPaging="True" Skin="Vista">
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<asp:ImageButton ID="ImageButton2" runat="server" Height="80px"
ImageUrl='<%# Eval("Pic_Path") %>' onclick="ImageButton2_Click"
Width="60px" />
</ItemTemplate>
</telerik:RadListView>
你能帮助我吗?
// ImageButton2_Click
foreach (RadListViewItem item in RadListView3.SelectedItems)
{
ImageButton btn = (ImageButton)item.FindControl("ImageButton2");
Image1.ImageUrl = btn.ImageUrl;
}