Asp.net Data list control show Image example
Step 1: add asp.net data list control
<div style="height: 450px;overflow-y: scroll;">
<asp:DataList runat="server" runat="server"
ID="dtlPhotos" OnItemDataBound="dtlPhotos_OnItemDataBind"
RepeatDirection="Horizontal" RepeatLayout="Flow" RepeatColumns="5" >
<ItemTemplate>
<div style="margin-left: 20px;display: inline-block;">
<div>
<asp:Image ID="imgPhoto" runat="server" Width="200" Height="200" />
</div>
<div>
<asp:CheckBox runat="server" ID="chkPhoto" Text='<%#Eval("Name")%>' />
<asp:HiddenField runat="server" ID="hdnPhotoId" Value='<%#Eval("PhotoId")%>'/>
</div>
</div>
</ItemTemplate>
</asp:DataList>
<asp:ImageButton runat="server" style="margin-bottom:20px;margin-left: 10px;" ImageUrl="../../Resource/Image/eDAS/add_document.png"
ID="dtlAddNew" Width="200" Height ="200" OnClick="dtlAddNew_Click"/>
</div>
Step 2: Data bind:
dtlPhotos.DataSource = EdasContext.ShoppingCartSession.Current.SnapShotDocuments;
dtlPhotos.DataBind();
Step 3: on data item bind :
dynamic data = e.Item.DataItem;
var img = e.Item.FindControl("imgPhoto") as Image;
if (img != null)
{
img.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(data.ImgStream);
}
Step 4: result :
相關文章
- WPF custom control contains datagrid,listbox,imageAI
- WPF image show web picture via url and converterWeb
- WPF customize ellipse fill with image/imagebrush and show text
- WPF Custom control and display binding and specific data
- WPF ListBox acted as thumbnail pictures container and associated with another image control and interactAI
- [Paper Reading] ControlNet: Adding Conditional Control to Text-to-Image Diffusion Models
- 微信開發之data:image/png;base64,
- 4.5.1.3.2 Example
- An example of polybase for OracleOracle
- simd example code
- Asp.Net Mvc5表單提交之List集合ASP.NETMVC
- JavaScript show()JavaScript
- show profiles
- [Typescript] Query builder exampleTypeScriptUI
- An example about git hookGitHook
- git show 命令Git
- JavaScript show() 方法JavaScript
- WPF Image Image clip EllipseGeometry
- Erlang vs Elixir by example – kv store
- Tell Me About Yourself Example 1
- 【RabbitMQ】direct type exchange example in golangMQGolang
- 【RabbitMQ】topic type exchange example in golangMQGolang
- 【RabbitMQ】fanout type exchange example in golangMQGolang
- show_space(轉)
- git show命令用法Git
- WPF ProgressBar show value
- Image
- WPF Customize control
- Cache-Control
- User Account Control
- [轉]Angular 4|5 Material Dialog with ExampleAngular
- Java Scheduler ScheduledExecutorService ScheduledThreadPoolExecutor Example(ScheduledThreadPoolExecu...Javathread
- sim3d multiple component example3D
- For example, when you want to get the ball to the ground
- vue.js axios call api exampleVue.jsiOSAPI
- MySQL 之 show processlist 神器MySql
- showModal()與show() 區別
- how to show hidden parameter(zt)
- WPF Image add watermark and save marked image as jpg