Using DataList - table and headers

Discussion in 'ASP .Net' started by Mirek Endys, Nov 21, 2005.

  1. Mirek Endys

    Mirek Endys Guest

    Hello,

    Im often use DataList for viewing and editing datas. For better layout
    controling, I create a table in the template and there I put other controls
    or binding data into table cells.

    Sometimes, I would use the HeaderTemplate as header of my table (in
    ItemTemplate).
    How to do it? How to make the table columns in HeaderTemplate linked to
    table columns in ItemTemplate?

    Thanks.

    Mirek.
    Mirek Endys, Nov 21, 2005
    #1
    1. Advertising

  2. Mirek,

    Wrap the table around the datalist like this:
    <table>
    <asp:DataList ...>
    <HeaderTemplate>
    <tr>...</tr>
    </HeaderTemplate>
    <ItemTemplate>
    <tr>...</tr>
    </ItemTemplate>
    </asp:DataList>
    </table>

    Eliyahu

    "Mirek Endys" <> wrote in message
    news:uy4W$...
    > Hello,
    >
    > Im often use DataList for viewing and editing datas. For better layout
    > controling, I create a table in the template and there I put other
    > controls or binding data into table cells.
    >
    > Sometimes, I would use the HeaderTemplate as header of my table (in
    > ItemTemplate).
    > How to do it? How to make the table columns in HeaderTemplate linked to
    > table columns in ItemTemplate?
    >
    > Thanks.
    >
    > Mirek.
    >
    >
    Eliyahu Goldin, Nov 21, 2005
    #2
    1. Advertising

  3. The datalist exposes a property named RepeatLayout which can have a value of
    either Table or Flow. To experiment with both outcome try this sample from
    the MSDN:
    http://msdn.microsoft.com/library/d...webcontrolsdatalistclassrepeatlayouttopic.asp

    The RepeatLayout=Flow would produce a span for each datalist item being
    rendered on the browser. This would prevent you from enclosing the entire
    datalist in a <Table> (where the header is only a Tablerow and each item in
    the body is another TableRow as the repeater would do).

    Therefore you should use CSS to align the columns within different tables by
    specifying the TD width values as I did in this sample:
    http://www.societopia.net/samples/DataList_Hierarchy.aspx

    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "Mirek Endys" wrote:

    > Hello,
    >
    > Im often use DataList for viewing and editing datas. For better layout
    > controling, I create a table in the template and there I put other controls
    > or binding data into table cells.
    >
    > Sometimes, I would use the HeaderTemplate as header of my table (in
    > ItemTemplate).
    > How to do it? How to make the table columns in HeaderTemplate linked to
    > table columns in ItemTemplate?
    >
    > Thanks.
    >
    > Mirek.
    >
    >
    >
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Nov 21, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nevyn Twyll
    Replies:
    8
    Views:
    1,843
  2. dont bother
    Replies:
    0
    Views:
    766
    dont bother
    Mar 3, 2004
  3. Phil
    Replies:
    4
    Views:
    658
    Gabriel Genellina
    Jan 17, 2010
  4. Ian
    Replies:
    2
    Views:
    1,907
  5. Mirek Endys

    Using DataList - table and headers

    Mirek Endys, Nov 21, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    131
    Phillip Williams
    Nov 21, 2005
Loading...

Share This Page