2011-08-16 73 views
0

是任何人都知道的任何方法来实现在ASPXGridView压痕(我们正在运行目前可用的版本10.x)动态压痕aspxgridview

我们得到

enter image description here

我们倒是想实现

enter image description here

有关代码隐藏一些信息。

网格由ObjectDataSource填充,并且缩进与其他数据一起存储在属性中。在例子中,BMI行将有0缩进,而GENDER将有1,MAN将有2等等。

缩进是计算运行时间,因为关系可能会改变。

public void GetItemsRecursive(int? parentId, int level) 
{ 
    List<qstFeedbackLine> q; 

    if (parentId == 0) 
     q = _db.qstFeedbackLines.Where(x => x.ParentId == null).ToList(); 
    else 
     q = _db.qstFeedbackLines.Where(x => x.ParentId == parentId).ToList(); 

    foreach (var item in q) 
    { 
     // Store the indent 
     item.Indent = level; 

     // Add item to List 
     _items.Add(item); 

     level++; 
     // ...and get the children of the current id 
     GetItemsRecursive(item.FeedBackLineId, level); 
    } 
} 

有什么建议吗?

谢谢!

回答