Question

I would like to reproduce the following design

+-----------------------------------+---+---+
| some text here                    | A | B |
+-----------------------------------+---+---+
| some multiline text here                  |
+-------------------------------------------+

Where A and B are fixed width columns containing images.

This would be easily accomplished using a <table> element like this

<table>
    <tr>
        <td>some text here</td>
        <td width="20"><img alt="" src="/imageurl" /></td>
        <td width="20"><img alt="" src="/imageurl" /></td>
    </tr>
    <tr><td colspan="3">some multiline text here</td></tr>
</table>

But I am using the Grid helper within the MVCContrib project. Is there a way to obtain a design like this one for every item inside a list of items?

Was it helpful?

Solution

You can implement your own GridRenderer. From Jeremy Skinner's blog:

The default GridRenderer is the HtmlTableGridRenderer. Which, surprisingly enough, renders the grid as an HTML table. By specifying your own GridRenderer, you can completely alter how the grid is rendered without resorting to completely rewriting the grid component.

You can get some ideas from HtmlTableGridRenderer's source code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top