Results 1 to 5 of 5

Thread: 3 item per row

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    3 item per row

    I use the code below to add a table with each datarow

    Code:
                TableRow rowItem = new TableRow();
                TableCell cellColumnInfo = new TableCell();
                cellColumnInfo.VerticalAlign = VerticalAlign.Top;
                cellColumnInfo.Width = 600;
    
                Label lblProdName = new Label();
                lblProdName.Text = dr["ProductName"].ToString();
                cellColumnInfo.Controls.Add(lblProdName);
                rowItem.Cells.Add(cellColumnInfo);
                
                Label lblProdDesc = new Label();
                lblProdDesc.Text = "<br>" + dr["ProductDescription"].ToString();
                cellColumnInfo.Controls.Add(lblProdDesc);
    
                //add the cells to the new row
                Table1.Rows.Add(rowItem);
    it works, but it only add only 1 item per row. all i want to happen is it will display the first 3 on the first row and the 2nd 3 on the second row.. and so on..

    how can I do that with asp.net?

  2. #2
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: 3 item per row

    Instead of using same cell i.e. cellColumnInfo may be you can add each column's value in New TableCell vairbale
    __________________
    Rate the posts that helped you

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: 3 item per row

    Hello,

    Rather than using a Table control, why not use a DataList:

    http://msdn.microsoft.com/en-us/libr...direction.aspx

    From what you have said, this is set up to do exactly what you want.

    Gary

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    Re: 3 item per row

    i want to display the items dynamically. hope you can help me with this..

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: 3 item per row

    Can you define "dynamically". The repeater will "grow" based on the number of records that you give it.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width