No "bordercolorlight" or "bordercolordark" table attributes with DataGrid ??

Discussion in 'ASP .Net Datagrid Control' started by Jim Moon, Dec 12, 2005.

  1. Jim Moon

    Jim Moon Guest

    I'm trying to get the same look and feel from a new ASPX page that I have in
    some older ASPs. They run side-by-side in a website.

    How do I get the <asp:DataGrid> to write the "bordercolordark" and
    "bordercolorlight" table attributes that I'm accustomed to using?

    Thanks,
    Jim
     
    Jim Moon, Dec 12, 2005
    #1
    1. Advertisements

  2. Jim Moon

    Jim Moon Guest

    Furthermore, how do you assign align="center" and other such attributes to
    individual columns?

    Jim
     
    Jim Moon, Dec 12, 2005
    #2
    1. Advertisements

  3. The easiest approach is to leave your table with all attributes as it is and
    to use a Repeater bound to your datasource with ItemTemplate ressembling the
    rows. You can use HeaderTemplate for the header. Something like this:
    <table width="100%" cellspacing="1">

    <colgroup span=3 class=TabGridItem></colgroup>

    <asp:Repeater Runat="server" id="dgActivity" DataMember="tblActivity"
    OnItemDataBound="dgActivity_ItemDataBound">

    <HeaderTemplate>

    <tr>

    <td class=TabGridHeader>Date</td>

    <td class=TabGridHeader>Event</td>

    <td class=TabGridHeader>User</td>

    </tr>

    </HeaderTemplate>

    <ItemTemplate>

    <tr runat="server" id="trAct">

    <td><%# ((System.Data.DataRowView)Container.DataItem)["Date"] %></td>

    <td><%# ((System.Data.DataRowView)Container.DataItem)["Event"] %></td>

    <td><%# ((System.Data.DataRowView)Container.DataItem)["User"] %></td>

    </tr>

    </ItemTemplate>

    </asp:Repeater>

    </table>


    I use this techigue quit a lot when I first make an html proptotype and than
    turn it into an aspx page.

    Eliyahu
     
    Eliyahu Goldin, Dec 13, 2005
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.