日期:2014-05-20  浏览次数:20530 次

DataList中ImageButton保存图片路径到session的问题
我想click   DataList中的ImageButton时,怎样将Image的url地址写到session中??

<asp:DataList   ID= "DataList1 "   runat= "server "   DataKeyField= "PictureId "
                                                DataSourceID= "PictureSystmeObjectDataSource "   RepeatColumns= "2 "   RepeatDirection= "Horizontal "   >
                                                <ItemTemplate>
                                                        <asp:ImageButton   ID= "ImageButton1 "   runat= "server "   ImageUrl= ' <%#   Eval( "PictureLocation ")   %> '   />
                                                </ItemTemplate>
</asp:DataList>

急。。   多谢!

------解决方案--------------------
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
ImageButton ImageButton1 = (ImageButton)e.Item.FindControl( "ImageButton1 ");
Session[ "ImageButton1Url "] = ImageButton1.ImageUrl;
}
------解决方案--------------------
<asp:DataList ID= "DataList1 " runat= "server " OnItemCommand= "DataList1_ItemCommand ">
</asp:DataList>