我的 aspx 中有一个数据列表,如下所示:
<asp:DataList
ID="dlSubs"
runat="server"
CellPadding="0"
CellSpacing="5"
RepeatDirection="Vertical">...</asp:Datalist>
当我在代码隐藏中执行此操作时:
this.dlSubs.DataSource = dtCat; // dtCat is a datatable with about 13 rows
this.dlSubs.DataBind();
一切都在一列(垂直)中呈现,但我想要两列......所以我这样做:
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();
但是当我执行上述操作时。它被水平渲染......这怎么可能?