Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rowspan in datagrid

Status
Not open for further replies.

Ankor

Programmer
Mar 21, 2002
144
US
Hello,

I'd like to build a datagrid that will have the first and second columns rowspaned. The quantity of rows in rowspan is fixed. There should be three of them. Could anyone point me to the source where I could get an idea how it can be done? Thank you.




 
Sounds to me like you want a datalist instead of a datagrid.

Basically the same thing except you can add table elements to the datalist so it's more customizeable (and not that hard to do). If you need me to post an example of a simple datalist then just let me know (if you decide to go that route).
 
I didn't really work with datalists, so an example would be great. I found couple samples that explain how it can be done in datagrid, but it's not quite what I need.
 
No problem. Here you go. Basically it's like a datagrid, except you can put tables inside of the elements so that can basically format things the way you want to...

Code:
<asp:DataList ID="dlShowSummary" runat="server" BackColor="White" BorderColor="Black"
        BorderStyle="Solid" BorderWidth="1px" CellPadding="3" Font-Size="Small" GridLines="Vertical"
        Width="95%" Font-Names="Arial" DataKeyField="codeID">
        <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
        <SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
        <ItemTemplate>
        <asp:Label ID="dllblCodeID" runat="server" Text='<%# Eval("codeID")  %>' Visible="false" />
        <table width="100%" border="0">
        <tr>
        <td>
            <asp:LinkButton Font-Bold="true" ID="dllnkTitle" runat="server" Text='<%# Eval("codeTitle")  %>' CommandName="cmdTitle" />
        </td>
        </tr>
        <tr>
        <td>
        <asp:Label ID="dllblText" runat="server" Text='<%# FormatDisplay(Eval("codeText")) %>'></asp:Label>
        </td>
        </tr>
        <tr>
        <td>
        <asp:Label ID="dllblDateEntered" runat="server" Text='<%# Eval("codeDateEntered") %>'></asp:Label>
        </td>
        </tr>
        </table>
        </ItemTemplate>
        <AlternatingItemTemplate>
        <table width ="100%" border="0">
        <tr>
        <td>
            <asp:LinkButton  Font-Bold="true" ID="dllnkTitle" runat="server" Text='<%# Eval("codeTitle")  %>' CommandName="cmdTitle"></asp:LinkButton>
        </td>
        </tr>
        <tr>
        <td>
        <asp:Label ID="dllblText" runat="server" Text='<%# Eval("codeText")) %>'></asp:Label>
        </td>
        </tr>
        <tr>
        <td>
        <asp:Label ID="dllblDateEntered" runat="server" Text='<%# Eval("codeDateEntered") %>'></asp:Label>
        </td>
        </tr>
        </table>
        </AlternatingItemTemplate>
        <AlternatingItemStyle BackColor="Gainsboro" Font-Bold="False" />
        <ItemStyle BackColor="#EEEEEE" ForeColor="Black" Font-Bold="False" Font-Names="Tahoma" />
        <HeaderTemplate>
           Summary
        </HeaderTemplate>
        <HeaderStyle BackColor="#88938D" Font-Bold="True" ForeColor="White" />
    </asp:DataList>

Let me know if you have any questions about it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top