开发者

Dynamic indentation in devexpress aspxgridview

Are anyone aware of any method to achieve indentation in the ASPXGridView (we are running the 10.x version currently available)

What we got

Dynamic indentation in devexpress aspxgridview

What we'd like to achieve

Dynamic indentation in devexpress aspxgridview

Some information about the code-behind.

The grid is populated by an ObjectDataSource and the indentation is stored in a property alongside with the other data. In example the BMI row will have 0 indentation while the GENDER will have 1, and MAN will have 2. Etc...

The indentation is calculated runtime since relations might change.

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);
    }
}

Any advice out there?

Thanks!


Ended up using the ASPxTreeList component instead!

http://demos.devexpress.com/ASPxTreeListDemos/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜