views:

306

answers:

2

hello everyone.

i have a datalist in my aspx like this:

<asp:DataList 
     ID="dlSubs" 
     runat="server" 
     CellPadding="0" 
     CellSpacing="5" 
     RepeatDirection="Vertical">...</asp:Datalist>

when i do this in the code-behind:

     this.dlSubs.DataSource = dtCat; // dtCat is a datatable with about 13 rows
     this.dlSubs.DataBind();

everything gets rendered in one column (vertical) but i want two colums... so i do this:

 DataTable dtCat = shop.DAL.ArtikelenDB.GetLeftMenu(Convert.ToInt32(Request.QueryString.Get("catg")));
 double tmpDouble = (double)dtCat.Rows.Count / 2.0;
 double repRow = Math.Ceiling(tmpDouble);
 dlSubs.RepeatColumns = Convert.ToInt32(repRow);
 dlSubs.RepeatDirection = RepeatDirection.Vertical; // also tried without this line...
 this.dlSubs.DataSource = dtCat;
 this.dlSubs.DataBind();

but when i do the above. it gets rendered horizontally... how is that possible?

A: 

Try setting the direction after binding your datasource.

Ravia
but the direction is allready set in the .aspx file... i will try it
JP Hellemons
i tried it, but didn't work. though thanks for your reply :)
JP Hellemons
A: 

i found it... i had to set the repeatcolumns to 2 instead of manually calculating the rows... the property name is still repeatCOLUMNS so i should have known that... when you turn the repeatdirection. it remains columns instead of switching to rows

my bad... sorry

JP Hellemons