C# 如何正确显示图像格式?
我从数据库中检索名称和图像,名称和图像按要求以aspx形式提供,但问题是图像仅显示一行,如“[image][image][image][image]”这种格式,但我需要2x2图像 aspx代码:C# 如何正确显示图像格式?,c#,asp.net,C#,Asp.net,我从数据库中检索名称和图像,名称和图像按要求以aspx形式提供,但问题是图像仅显示一行,如“[image][image][image][image]”这种格式,但我需要2x2图像 aspx代码: <asp:Repeater ID="reapterclient" runat="server" OnItemDataBound="repeaterclient_OnItemDataBound"> <
<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>
试试看
在向社区提问之前,请稍等片刻,放慢语速,并正确表述您的问题。你想要一个看起来像你的问题的答案吗?任何人都在这里。这是紧急的。你可以接受乔治的建议,正确地格式化你的问题,帮助你自己的事业,因此,潜在的回答者可以阅读代码。没有avd正确的格式仍然没有出现我想要像一个图像一样右一个左所有Client\u Logo
也存储图像格式吗?例如:Client\u Logo=“Logo.png”
@JamesJohnson-如果是字节数组(blob),则无法工作。我猜client_徽标是varchar,它包含文件名和相对路径。伙计们,我得到了解决方案,它是使用asp:table完成的,但谢谢你的建议
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();
}
<asp:Image
ID="imgClient"
runat="server"
ImageUrl='<%# Eval("Client_Logo","~/clients_images/{0}") %>'