Detailview add row colspan 2

I have a detailsview. In the middle of the view I want to add a HEADER that spans across two columns. I am not able to get the row to colspan=2. Here’s my code:

 <asp:TemplateField HeaderText="Representative">
                            <HeaderStyle  CssClass="formHdrBg" HorizontalAlign="Right"  Height="30" Font-Bold="True"/>
                        <ItemStyle CssClass="formHdrBg"/>

How can I merge these two together?


With the details view you are pretty stuck since the basic structure is a 2 column table so no matter what you do your header will be in the left hand cell. The only option would be to take a look at the control adapter for the details view. At the very least the code gives a good example of how to change what html is output in a much easier way than say overriding the render of the control.

Hi BrianOConnell, thanks for the feedback, I was worried about this. FYI, the link you submitted is dead.

Seems to have been temporarily down. Back up now.

Try this:

<asp:TemplateField ShowHeader="false">
        <asp:Label ID="Label1" runat="server" Text="table cell renders as colspan=2"></asp:Label>

Man, MVC owns ASP.NET Controls. Gives you 100% power over the markup, and your not bound to bs that spits out to the browser. Couldn’t you use a ListView for more contol over the display? Then again, I really don’t know crap about newer ASP.NET Display Controls . I was always a fan of the Repeater, RIP…