heres an easy one i think..DataList item widths...

Discussion in 'ASP .Net Web Controls' started by Sam Martin, Mar 31, 2006.

  1. Sam Martin

    Sam Martin Guest

    Hi,

    I have a user control containing a DataList. - all good.

    <asp:DataList id="DataListMain" runat="server" RepeatDirection="Horizontal"
    RepeatColumns="4"Width="100%" HorizontalAlign="Left">

    Columns = 4, rendered Horzontaly. This works fine where is more than 4 items
    in the datasource, however when <4 the items, for example 2 (because it
    generates a table) are spread evenly over two cells, opposed to four;
    meanning that the item widths are wider than i'd like them.

    I want each cell to be the same size irrespective of whether the number of
    items exceeds the RepeatColumns. I've tried setting the ItemStyle.Width
    however this just puts in a style="100px" into the cell, and doesn't effect
    the layout of the table.

    I've tried using the "flow" repeat layout, however, as each of my items is
    in fact a <table> the browser renders each item beneath the last.

    there must be a simple way of setting the with of the cell no?

    --
    TIA
    Sam Martin
    Sam Martin, Mar 31, 2006
    #1
    1. Advertising

  2. Sam Martin

    Sam Martin Guest

    sorry

    ignore that, it was easy. just remove the width attribute.
    means the table will always be as wide as the contents it holds.

    thanks anyway

    --
    TIA
    Sam Martin


    "Sam Martin" wrote:

    > Hi,
    >
    > I have a user control containing a DataList. - all good.
    >
    > <asp:DataList id="DataListMain" runat="server" RepeatDirection="Horizontal"
    > RepeatColumns="4"Width="100%" HorizontalAlign="Left">
    >
    > Columns = 4, rendered Horzontaly. This works fine where is more than 4 items
    > in the datasource, however when <4 the items, for example 2 (because it
    > generates a table) are spread evenly over two cells, opposed to four;
    > meanning that the item widths are wider than i'd like them.
    >
    > I want each cell to be the same size irrespective of whether the number of
    > items exceeds the RepeatColumns. I've tried setting the ItemStyle.Width
    > however this just puts in a style="100px" into the cell, and doesn't effect
    > the layout of the table.
    >
    > I've tried using the "flow" repeat layout, however, as each of my items is
    > in fact a <table> the browser renders each item beneath the last.
    >
    > there must be a simple way of setting the with of the cell no?
    >
    > --
    > TIA
    > Sam Martin
    Sam Martin, Mar 31, 2006
    #2
    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. cory

    Heres one for you...

    cory, Jan 15, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    315
    Kevin Spencer
    Jan 15, 2004
  2. =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=

    easy one I think! Property not recognised in HTML view

    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=, Dec 29, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    376
    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=
    Dec 31, 2004
  3. =?Utf-8?B?RGF2aWQgRGF2aXM=?=

    menu item individual widths

    =?Utf-8?B?RGF2aWQgRGF2aXM=?=, Aug 8, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    324
    =?Utf-8?B?RGF2aWQgRGF2aXM=?=
    Aug 8, 2006
  4. Travis Newbury
    Replies:
    12
    Views:
    632
    dorayme
    Jun 21, 2007
  5. Bender
    Replies:
    4
    Views:
    154
    Bender
    Sep 6, 2003
Loading...

Share This Page