日期:2014-05-18  浏览次数:20679 次

在前台输出img
C# code
<%if (projects != null) {
                          for (int ix = 0; ix < projects.Count; ix++) 
                          {
                              if (projects != null && ix < projects.Count) 
                              {
                              %>
 <tr>
                        <td rowspan="4" width="280" align="left">
                            <asp:Image ID="Image1" runat="server" Width="277" Height="178" ImageUrl="" />
                            
                        </td>
                        <td valign="top" align="left" style="height:5px;">
                            <strong style="font-size:14px;">
                            &nbsp;&nbsp;&nbsp;&nbsp;<%Response.Write(convertNullToString(projects[ix].XmName)); %></strong><br />
                            <asp:Label ID="Label1" runat="server" Text="【" CssClass="leftl"></asp:Label>
                            <%=convertNullToString(projects[ix].XmCity) %>
                            <asp:Label ID="Label2" runat="server" Text="】" CssClass="leftr"></asp:Label>
                        </td>
                        <td rowspan="4"  align="right" valign="top">
                            <asp:Image ID="Image2" runat="server" />
                        </td>
                    </tr>   




img该怎样输出?

------解决方案--------------------
<img src=
<asp:Image
前提是你有路径
如果是二进制
要单独输出了
------解决方案--------------------
HTML code
<%if (projects != null) {
                          for (int ix = 0; ix < projects.Count; ix++) 
                          {
                              if (projects != null && ix < projects.Count) 
                              {
                                  Response.Write("<img src='a.jpg'/>");
                              }
                          }
                  }
                              %>

------解决方案--------------------
 
<asp:Image ID="Image2" runat="server" src="~/Files/"+图片的名称 />