detailviews空间中怎么让图片靠左文字靠右

img


怎么让图片靠左文字靠右 图片和文字都来自数据库。用detailviews控件显示的,asp.net+x#


<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="商品编号" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3">
            <EditRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
    <Fields>
       
        
        <asp:BoundField DataField="型号" HeaderText="型号" />
        <asp:BoundField DataField="单价" HeaderText="单价" />
        <asp:BoundField DataField="库存数量" HeaderText="库存数量" />
    </Fields>
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <FooterTemplate>
                <table  style="width:100%; ">
                    <tr>
                        <td rowspan="3"><asp:Image  Width="175px" Height="175px" ID="Image1" runat="server" ImageUrl='<%# Eval("图片", "{0}") %>' /></td>
              
                    </tr>
                </table>
            </FooterTemplate>
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <RowStyle ForeColor="#000066" />
</asp:DetailsView>

使用ItemStyle-HorizontalAlign="Right" 以调整字段中的文本对齐方式。而图像你可以使用ImageAlign="left"。简单示例:

<Fields>
                    <asp:BoundField DataField="型号" HeaderText="型号" ItemStyle-HorizontalAlign="Right"/>
                    <asp:BoundField DataField="单价" HeaderText="单价" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="库存数量" HeaderText="库存数量" ItemStyle-HorizontalAlign="Right" />
                </Fields>
                <FooterStyle BackColor="White" ForeColor="#000066" />
                <FooterTemplate>
                    <table style="width: 100%;">
                        <tr>
                            <td rowspan="3">
                                <asp:Image Width="10px" Height="10px" ID="Image1" runat="server" ImageUrl="/Image/test.png" ImageAlign="left" />
                            </td>
                        </tr>
                    </table>
                </FooterTemplate>

结果:

img