locked
Gridview extension RRS feed

  • Question

  • User1132658998 posted

    I am trying to figure out how to extend the GridView control to have a group header similar to a report.

    So this:

    Team               Player          Games Played   Comments

    Arizona            Web             1                       (enter comments)
    Diamondbacks 

    Arizona           Byrnes           1                       (enter comments)
    Diamondbacks

    Becomes This:

    Team: Arizona Diamondbacks

    Player             Games Played  Comments

    Web                 1                     (enter comments)

    Byrnes             1                     (enter comments)

    Of course I could build the table on the fly, but I would like something more reusable.

    Tuesday, April 1, 2008 11:08 AM

Answers

  • User-1703611609 posted

    use a datalist. 

    <asp:DataList ID="DataList1" runat="server" DataSourceID="" Width="100%">
                <ItemTemplate>
                    <table border="0" cellpadding="0" cellspacing="0" style="width: 25%">
                        <tr>
                            <td style="width: 50px">Team:</td>
                            <td><asp:Label ID="Label1" runat="server" Text=""></asp:Label></td>
                        </tr>
                    </table>
                    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                        <tr>
                            <td style="width: 33%">Player</td>
                            <td style="width: 33%">Games Played</td>
                            <td style="width: 33%">Comments</td>
                        </tr>
                        <tr>
                            <td style="width: 33%"><asp:Label ID="Label2" runat="server" Text=""></asp:Label></td>
                            <td style="width: 33%"><asp:Label ID="Label3" runat="server" Text=""></asp:Label></td>
                            <td style="width: 33%"><asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Width="300px" Height="125px"></asp:TextBox></td>
                        </tr>
                    </table>
                </ItemTemplate>
                <AlternatingItemStyle BackColor="Silver" />
                <ItemStyle BackColor="#E0E0E0" />
            </asp:DataList>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 1, 2008 11:44 AM