Datalist Control

Discussion in 'ASP .Net Web Controls' started by Peter Afonin, May 3, 2010.

  1. Peter Afonin

    Peter Afonin Guest

    Hello,

    I'm using Datalist control with ASP.NET 3.5. I don't have much experience
    with this control, so perhaps I don't quite understand how it works.

    The data in the table look approximately like this:

    1
    2
    3
    4
    5
    6
    1
    2
    3
    ......

    and so on, just repeating numbers from 1 to 6 (same is true for 1 to 12 or
    any other sequence).

    If I set the datalist this way:

    RepeatColumns 0
    RepeatDirection Vertical
    RepeatLayout Table

    it looks like this:

    1 6 5 4
    2 1 6 5
    3 2 1 6
    4 3 2 1
    5 4 3 2 etc.

    and so on. It always move the last value to the next column.

    Instead, it always shows 6 columns (or 12 for 1-12 etc.)

    If I set RepeatDirection Horizontal it looks like:

    1 2 3
    1 2 3
    1 2 3
    1 2 3
    1 2 3 etc., which is not what I need.

    I need it to look like this

    1 1 1
    2 2 2
    3 3 3
    4 4 4
    5 5 5
    6 6 6 etc.

    Could you help me please?

    Thank you.
     
    Peter Afonin, May 3, 2010
    #1
    1. Advertisements

  2. On May 4, 12:41 am, "Peter Afonin" <> wrote:

    >
    > RepeatColumns 0
    > RepeatDirection Vertical
    > RepeatLayout Table
    >
    > it looks like this:
    >
    > 1 6 5 4
    > 2 1 6 5
    > 3 2 1 6
    > 4 3 2 1
    > 5 4 3 2 etc.
    >
    > and so on. It always move the last value to the next column.
    >


    Well, "6" is not the "last" value and that's the problem. The Datalist
    control is based on your datasource and a number of columns you have
    set in the RepeatColumns property. It seems that you've set it to more
    than 0, because 0 indicates that the items in the DataList control are
    displayed in a single column, see here

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datalist.repeatcolumns.aspx

    To understand how it works, just make less data in your source table,
    e.g. just 24 rows (3 times from 1 to 6) or do "select top 24 * from
    table1..."

    and set RepeatColumns = 3 and RepeatDirection Vertical

    You will get this
    1 1 1
    2 2 2
    3 3 3
    4 4 4
    5 5 5
    6 6 6

    because of "proper" number of columns.

    Try to change the value of RepeatColumns and you will see that the
    flow will be changed as well.
     
    Alexey Smirnov, May 4, 2010
    #2
    1. Advertisements

  3. Peter Afonin

    Peter Afonin Guest

    Thank you, I'll check this out.

    For some reason the RepeatColumns property doesn't work at all. Whether I
    set it to 0 or any other number - it doesn't change anything when I open the
    page, I can see the changes only in design time.

    Peter

    "Alexey Smirnov" <> wrote in message
    news:...
    On May 4, 12:41 am, "Peter Afonin" <> wrote:

    >
    > RepeatColumns 0
    > RepeatDirection Vertical
    > RepeatLayout Table
    >
    > it looks like this:
    >
    > 1 6 5 4
    > 2 1 6 5
    > 3 2 1 6
    > 4 3 2 1
    > 5 4 3 2 etc.
    >
    > and so on. It always move the last value to the next column.
    >


    Well, "6" is not the "last" value and that's the problem. The Datalist
    control is based on your datasource and a number of columns you have
    set in the RepeatColumns property. It seems that you've set it to more
    than 0, because 0 indicates that the items in the DataList control are
    displayed in a single column, see here

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datalist.repeatcolumns.aspx

    To understand how it works, just make less data in your source table,
    e.g. just 24 rows (3 times from 1 to 6) or do "select top 24 * from
    table1..."

    and set RepeatColumns = 3 and RepeatDirection Vertical

    You will get this
    1 1 1
    2 2 2
    3 3 3
    4 4 4
    5 5 5
    6 6 6

    because of "proper" number of columns.

    Try to change the value of RepeatColumns and you will see that the
    flow will be changed as well.
     
    Peter Afonin, May 4, 2010
    #3
    1. Advertisements

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.
Similar Threads
  1. Gönen EREN

    Datalist in Datalist How?

    Gönen EREN, Aug 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    608
    Gönen EREN
    Aug 22, 2003
  2. acko bogicevic

    DataList in DataList

    acko bogicevic, Nov 10, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    5,913
    acko bogicevic
    Nov 11, 2003
  3. Steve Lloyd
    Replies:
    1
    Views:
    868
    Rick Spiewak
    May 26, 2004
  4. Nevyn Twyll
    Replies:
    8
    Views:
    2,393
  5. Luis Esteban Valencia
    Replies:
    1
    Views:
    696
    John Saunders
    Jan 6, 2005
  6. Steve
    Replies:
    0
    Views:
    3,314
    Steve
    Feb 1, 2005
  7. schapopa
    Replies:
    1
    Views:
    728
    schapopa
    Jan 12, 2006
  8. Mirek Endys

    DataList in DataList, how to do it???

    Mirek Endys, Mar 3, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    5,331
    Mirek Endys
    Mar 6, 2006
Loading...