ASP.NET Table with Variable Number of Columns
<p>I have to display some tabular data where there is a maximum of 3 columns to be displayed, but sometimes, only 1 or 2 are required.  Thus far, I have:</p>

<pre><code>&lt;asp:FormView ID="myFormView" runat="server" DataSourceID="myXmlDataSource"&gt;
    &lt;ItemTemplate&gt;
        &lt;table cellspacing="0" cellpadding="0" class="myTableStyle"&gt;
            &lt;colgroup&gt;
                &lt;col class="myCol1Style" /&gt;
                &lt;col class="myCol2Style" /&gt;
                &lt;col class="myCol3Style" /&gt;
            &lt;/colgroup&gt;
            &lt;thead&gt;
                &lt;tr&gt;
                    &lt;th class="myCol1HeaderStyle"&gt;Column 1&lt;/th&gt;
                    &lt;th class="myCol2HeaderStyle"&gt;Column 2&lt;/th&gt;
                    &lt;th class="myCol3HeaderStyle"&gt;Column 3&lt;/th&gt;
                &lt;/tr&gt;
            &lt;/thead&gt;
            &lt;tr&gt;
                &lt;td&gt;
                    &lt;p&gt;Column 1 data goes here&lt;/p&gt;
                &lt;/td&gt;
                &lt;td&gt;
                    &lt;p&gt;Column 2 data goes here&lt;/p&gt;
                &lt;/td&gt;
                &lt;td&gt;
                    &lt;p&gt;Column 3 data goes here&lt;/p&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/ItemTemplate&gt;
&lt;/asp:FormView&gt;
&lt;asp:XmlDataSource ID="myXmlDataSource" runat="server" /&gt;
</code></pre>

<p>Column 1 will always be displyed, but in some cases, I'll need to hide column 2 and/or 3.</p>

<p>What would be the best way to handle this?</p>
