2012-03-28 125 views
0

我想從後面的代碼中添加一列到數據綁定ASPxTreeList。我想要添加的列始終是我的表的數據字段之前的第一列。將數據綁定添加到數據綁定DevExpress ASPxTreeList

我手動設置可見索引= 0,但我的表的數據字段也有visibleIndex = 0,因此未綁定列的結果佈局將顯示爲第二列而不是第一列。

無論如何,總是確保我添加的未綁定列總是在第一列,即使使用數據綁定ASPxTreeList?

類似的情況就像設置SettingsSelection.Enabled = true,那麼複選框列將顯示在第一列。

回答

0

您是否嘗試過與Columns.Insert插入列:treeList.Columns.Insert(0, column)
編輯:我測試了我的解決方案,這是結論:
Columns.Insertcolumn.VisibleIndex = 0作品。
Columns.Addcolumn.VisibleIndex = 0不起作用。

protected void treeList_OnInit(object sender, EventArgs e) 
{ 
    TreeListTextColumn column = new TreeListTextColumn {Name = "Unbound", VisibleIndex = 0}; 
    // works 
    treeList.Columns.Insert(0, column); 
    // doesn't work 
    //treeList.Columns.Add(column); 
} 
+0

插入方法僅影響treelist.columncollection索引,但不影響可見索引。我剛剛計算和完成的是我使用forloop進入visibleColumn並更改其可見索引+ 1,然後指定我的未綁定列visibleIndex = 0。 感謝菲利普的建議。 – JohnZai 2012-03-28 07:52:28

+0

@JohnZai我更新了我的答案。 – Filip 2012-03-28 10:30:59

相關問題