• Here's an example of a couple columns in a GridView that include HTML. There's one with a

    tag that links an <img> tag and a column with a <br /> tag. You can use this approach to format your output.

    <asp:GridView ID="grdData" runat="server" AutoGenerateColumns="false"

    AllowPaging="true" ShowFooter="True" AllowSorting="False"

    CssClass="tdat" BorderWidth="0" CellSpacing="1" CellPadding="1" PageSize="20">

    <Columns>

    <asp:TemplateField HeaderText="Report" ItemStyle-Width="60" ItemStyle-HorizontalAlign="Center">

    <ItemTemplate>

    <asp:HiddenField ID="txtID" runat="server" Value='<%#Eval("ID")%>' />

    <asp:Panel ID="pnlReport" runat="server">

    <a href='/Files/Exports/<%#Eval("Filename")%>'><img src="images/buttons/excel_sm.gif" alt="Open File" title="Open File" /></a>

    </asp:Panel>

    </ItemTemplate>

    </asp:TemplateField>

    <asp:TemplateField HeaderText="Address" ItemStyle-HorizontalAlign="Left">

    <ItemTemplate>

    <asp:Label ID="lblAddress" runat="server" Text='<%#Eval("ShowAddress")%>' />

    <asp:Label ID="lblState" runat="server" Text='<%#Eval("ShowState")%>' />

    </ItemTemplate>

    </asp:TemplateField>

    <asp:BoundField HeaderText="Year" DataField="ShowYear" ItemStyle-Width="80" ItemStyle-HorizontalAlign="Center" ItemStyle-CssClass="pl4" />

    </asp:GridView>

    I have the CSS class "pl4" defined to have padding-left: 4px; I'm showing the image as an <img> instead of an ImageButton for a very specific reason with how the client's browsers are configured, but that's beyond the scope here. My intent is to show how to use HTML inside a GridView control.

    If you want them to appear in different columns in the GridView, simply use BoundColumns for the separate fields.

    I know this is now well outside the realm of T-SQL in this SQL forum, so I don't want to "go down too many rabbit holes" with it and turn it into a discussion of .NET.

    I hope this helps.