Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One way to do this is to set the cell's background to the image using CSS and write the price as plain text into the same cell (rendered output displayed): </p> <pre><code>&lt;td class="product" style="background: url(path-to-image.png) top left no-repeat"&gt; &lt;span class="price"&gt;$ 3.22&lt;/span&gt; &lt;/td&gt; </code></pre> <p>The only downside to this approach is that the cell would have to be explicitly sized to the same dimensions as the image, which you may not know.</p> <p>Another option is to use an <code>&lt;img&gt;</code> element inside the cell and still use a <code>&lt;span&gt;</code> for the plain text price (rendered output displayed):</p> <pre><code>&lt;td class="product"&gt; &lt;img src="path-to-image.png" alt="..."/&gt; &lt;span class="price"&gt;$ 3.22&lt;/span&gt; &lt;/td&gt; </code></pre> <p>Regardless of which method, you would use CSS to position and style the price within the cell:</p> <pre><code>td.product { position: relative } span.price { position: absolute; top : 40px; &lt; whatever works for you left: 40px; &lt; } </code></pre> <h3>A very simple GridView example with templating</h3> <p>You will need to set the GridView's <code>AutoGenerateColumns</code> property to false and handle the column creation and templating yourself. </p> <pre><code>&lt;asp:GridView ID="products" runat="server" AutoGenerateColumns="false" DataKeyNames="productId" DataSourceID="ObjectDataSource1"&gt; &lt;Columns&gt; &lt;asp:BoundField DataField="productId" HeaderText="Product ID" /&gt; &lt;asp:TemplateField HeaderText="Whatever ..."&gt; &lt;ItemTemplate&gt; &lt;img src='&lt;%# DataBinder.Eval(Container.DataItem,"productImageUrl") %&gt;' alt="..." /&gt; &lt;span class="price"&gt; &lt;%# DataBinder.Eval(Container.DataItem,"productPrice","{0:c}") %&gt; &lt;/span&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:BoundField DataField="productDesc" HeaderText="Description" /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload