Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have the same requirement to rotate a Grid as I'm replicating the QueryWizard in ASP.NET and the data is more manageable flipped on its side.</p> <p>My prototype consisted of a Repeater that dumped the row out vertical rows, but formatting is a bit messy if you have unpredictable data lengths as the tables need to have set line-height, width and an overflow:hidden to appear uniformed. - but I guess a simple nobr would suffice. </p> <pre><code>&lt;HeaderTemplate&gt; &lt;table&gt; &lt;tr&gt;&lt;td&gt; &lt;table&gt; &lt;tr&gt;&lt;td&gt;ColumnName1&lt;/td&gt;&lt;/tr&gt; &lt;td&gt;&lt;td&gt;ColumnName2&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;td&gt; &lt;table&gt; &lt;tr&gt;&lt;td&gt;&lt;%# Eval("Column1") %&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;%# Eval("Column2") %&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/FooterTemplate&gt; </code></pre> <p>My plan of attack for Monday was to override the GridView render method and then loop the Rows to have them render as required. I will post back to let you know my progress</p> <p>Pseudocode - something like</p> <pre><code>for(int c=0; c &lt; columns.Count; c++) { writer.Write("&lt;tr&gt;"); writer.Write("&lt;td&gt;" + columns[c].Title + "&lt;/td&gt;"); for(int r=0; r &lt; rows.Count; r++) { rows[r].Cells[c].render(writer); } writer.Write("&lt;/tr&gt;"); } </code></pre> <p>By letting the Cell handle the rendering you shouldn't need to do anything different with Binding or the ViewState.</p>
 

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