如何显示图像的正确格式?

时间:2011-10-11 13:13:49

标签: c# asp.net

我从数据库中检索名称和图像,名称和图像是以aspx的形式出现的,但问题是图像只显示一行,如“[image] [image] [image] [image]”这种格式但我想要2x2图像

aspx代码:

<asp:Repeater ID="reapterclient" runat="server" OnItemDataBound="repeaterclient_OnItemDataBound">
                                            <ItemTemplate>
                                            <table width="645" align="left" cellpadding="8" cellspacing="01" border="0" bgcolor="#252525">
                                            <tr bgcolor="#lclclc" height="40">
                                            <td id="tdcollection" width="50%" align="center" valign="middle" class="general"><asp:Image ID="imgClient" runat="server" ImageUrl='<%#"~/clients_images/"+Eval("Client_Logo") %>' Visible="true" Height="67" Width="380"/><br />
                                            <asp:Label ID="lblimgClient" runat="server" Text='<%#Eval("Client_Name") %>' Visible="true"></asp:Label>
                                            </td>


                                            </tr>
                                            <tr>
                                            <td colspan="2"/>
                                            </tr>

                                            </table>
                                            </ItemTemplate>


                                </asp:Repeater>

cs code:

public void binddata()
        {
            SqlDataAdapter sda = new SqlDataAdapter("select Client_Name,Client_Logo from tp_Client_Master where (Project_Type like '%commercial%')",con);
            DataSet ds = new DataSet();
            sda.Fill(ds);
            reapterclient.DataSource = ds;
            reapterclient.DataBind();
        }

1 个答案:

答案 0 :(得分:1)

尝试,

<asp:Image 
      ID="imgClient" 
      runat="server" 
      ImageUrl='<%# Eval("Client_Logo","~/clients_images/{0}") %>'