Define Datalist HeaderTemplate in c# from code behind
<p>I wrote following code in aspx, and the problem is that i need to create same datalist from code behind in C#:</p>

<pre><code>&lt;asp:DataList ID="DataList1" runat="server"&gt;
    &lt;HeaderTemplate&gt;
        &lt;tr&gt;
            &lt;th style="background-color: Black;"&gt;
                &lt;div style="color: White; font-size: medium; padding: 0; margin: 0;"&gt;
                    TEST&lt;/div&gt;
            &lt;/th&gt;
            &lt;th&gt;
                &lt;div style="background-color: #ADAAB1; color: #E3E2E7; padding: 5px; font-size: x-small;"&gt;
                    date&lt;/div&gt;
            &lt;/th&gt;
            &lt;th&gt;
                &lt;div style="background-color: #ADAAB1; color: #E3E2E7; padding: 5px; font-size: x-small;"&gt;
                    Buy/Sell&lt;/div&gt;
            &lt;/th&gt;
            &lt;th&gt;
                &lt;div style="background-color: #ADAAB1; color: #E3E2E7; padding: 5px; font-size: x-small;"&gt;
                    Call/Put&lt;/div&gt;
            &lt;/th&gt;
            &lt;th&gt;
                &lt;div style="background-color: #ADAAB1; color: #E3E2E7; padding: 5px; font-size: x-small;"&gt;
                    name&lt;/div&gt;
            &lt;/th&gt;
            &lt;th&gt;
                &lt;div style="background-color: #ADAAB1; color: #E3E2E7; padding: 5px; font-size: x-small;"&gt;
                    amount&lt;/div&gt;
            &lt;/th&gt;
            &lt;th&gt;
                &lt;div style="background-color: #ADAAB1; color: #E3E2E7; padding: 5px; font-size: x-small;"&gt;
                    price1&lt;/div&gt;
            &lt;/th&gt;
            &lt;th&gt;
                &lt;div style="background-color: #ADAAB1; color: #E3E2E7; padding: 5px; font-size: x-small;"&gt;
                    price2&lt;/div&gt;
            &lt;/th&gt;
        &lt;/tr&gt;
    &lt;/HeaderTemplate&gt;
    &lt;ItemTemplate&gt;
        &lt;div&gt;
            &lt;tr&gt;
                &lt;td&gt;
                    &lt;div style="background-color: #71B24C; color: White; height: 50px; text-align: center;"&gt;
                        &lt;%# Eval("option")%&gt;&lt;/div&gt;
                &lt;/td&gt;
                &lt;td&gt;
                    &lt;div style="background-color: #ADAAB1; color: White; height: 50px; padding-right: 5px;
                        font-size: medium; text-align: center;"&gt;
                        &lt;%# Eval("date")%&gt;&lt;/div&gt;
                &lt;/td&gt;
                &lt;td&gt;
                    &lt;div style="background-color: #D9D9D3; padding-right: 5px; height: 50px; font-size: medium;
                        text-align: center;"&gt;
                        &lt;%# Eval("type")%&gt;&lt;/div&gt;
                &lt;/td&gt;
                &lt;td&gt;
                    &lt;div style="background-color: #D9D9D3; padding-right: 5px; height: 50px; font-size: medium;
                        text-align: center;"&gt;
                        &lt;%# Eval("action")%&gt;&lt;/div&gt;
                &lt;/td&gt;
                &lt;td&gt;
                    &lt;div style="background-color: #D9D9D3; padding-right: 5px; height: 50px; font-size: medium;
                        text-align: center;"&gt;
                        &lt;%# Eval("pos_name")%&gt;&lt;/div&gt;
                &lt;/td&gt;
                &lt;td&gt;
                    &lt;div style="background-color: #D9D9D3; padding-right: 5px; height: 50px; font-size: medium;
                        text-align: center;"&gt;
                        &lt;%# Eval("amount")%&gt;&lt;/div&gt;
                &lt;/td&gt;
                &lt;td&gt;
                    &lt;div style="background-color: #D9D9D3; padding-right: 5px; height: 50px; font-size: medium;
                        text-align: center;"&gt;
                        &lt;%# Eval("unitPrice")%&gt;&lt;/div&gt;
                &lt;/td&gt;
                &lt;td&gt;
                    &lt;div style="background-color: #D9D9D3; padding-right: 5px; height: 50px; font-size: medium;
                        text-align: center;"&gt;
                        &lt;%# Eval("total")%&gt;&lt;/div&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/div&gt;
    &lt;/ItemTemplate&gt;
&lt;/asp:DataList&gt;
</code></pre>

<p>I mean that code that i demonstrating works perfectly in aspx page. I am interesting in getting same effect (display datalist) but through the code behind. I mean to code in code behind something like : DataList = new DataList(); My problem is, i dont know how to work with HeaderTemplate within code behind.
If you can provide example code, it would be nice!</p>
