如何在datalist中动态绑定图像 [英] How can i bind image dynamically inside the datalist

查看:104
本文介绍了如何在datalist中动态绑定图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行时绑定了datalist字段。我的SQL数据库中有图像的二进制数据值。我需要用图像显示我的所有数据。显示我的所有数据,但运行时不显示图像。我怎样才能做到这一点。有人请帮助我。



我能给出???? aspx文件中的符号。需要什么代码才能满足我的要求?



Aspx文件:





I am bind the datalist fields at runtime. I have a binary data value of images in my SQL database. I need to display all my data''s with images. All my datas are displayed but images are not displayed at runtime. How can i do that. Anyone please help me.

i can given the ???? symbol inside the aspx file. What code is need there to fullfill my requirement?

Aspx file :


<asp:DataList ID="DataList1" runat="server" RepeatColumns="3">
                 <ItemTemplate>
            <table style=" background-color:Window; border-bottom:1px solid #CDCDCD; width:300px; height: 150px" cellpadding="2"><tr><td>
            Baby Name <td>:</td></td><td width="50%">

            <%#DataBinder.Eval(Container.DataItem, "Baby_Name")%>
            <tr ><td>
            Father Name <td>:</td></td><td width="50%">
            <%#DataBinder.Eval(Container.DataItem, "Father_Name")%></td></tr>
            <tr ><td width="50%">
            Mother Name <td>:</td></td><td>
            <%#DataBinder.Eval(Container.DataItem, "Mother_Name")%></td></tr>
            <tr ><td width="100">
              ???????????????????????????????????????????
            </td></tr>
           </table>
            </ItemTemplate>

                </asp:DataList>









Aspx.cs文件::







Aspx.cs File ::

public partial class Today_Birthday_Babys : System.Web.UI.Page
{
    UserClass ObjUser = new UserClass();
 
    protected void Page_Load(object sender, EventArgs e)
    {
        DataSet ds = new DataSet();
        DateTime dob = DateTime.Now;
        ds = ObjUser.select_birthdaybaby(dob);
        DataList1.DataSource = ds;
        DataList1.DataBind();
    }
}

推荐答案

您可以使用HTTPHandlers。将图像id作为查询字符串传递给处理程序,它将返回图像。 这是一个非常好的示例 [ ^ ]
You can use HTTPHandlers. Pass image id as querystring to the handler and it will return the image. This is a very good example[^]


http://stackoverflow.com/questions/732406/asp-net-datalist-bind-array-of-imageurls [ ^ ]


这篇关于如何在datalist中动态绑定图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆