I have a couple questions related to RadGridView Self-Reference Hierarchy:
1. Is there a way to use the properties of System.Guid type as parent/child IDs? or only Int type?
2. How to configure a grid to be able to specify the columns manually and set AutoGenerateColumns property to false. I was not able to achieve it.
Thanks in advance!
5 Answers, 1 is accepted
3. Why pinned columns ignore RowFormatting event? For example, BackColor value.
4. If grid is set up as AutoSizeRows = true, pinned column is word wrapped and contains multi-lined text, non pinned columns' row height does not equal to pinned row height. Why?
5. If grid is set up using Column Groups, then pinned and unpinned rows have different row heights. when grid.AutoSizeRows = true
Can I get any answers on my questions?
Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.
As a gesture of good will we will adress your questions:
1. You can use Guid for parent id/ child id when building a self- reference hierarchy. It is important just to add properly the self-reference relation. Additional information is available in the following help article: https://docs.telerik.com/devtools/winforms/gridview/hierarchical-grid/self-referencing-hierarchy
2. When the AutoGenerateColumns property is set to false and you add manually the columns note that it is important to specify the FieldName property to the respective field in the DataSource. You can find below a sample code snippet:
3. Since CellFormatting/RowFormatting events are fired only for the data cells/rows, the ViewCellFormatting/ViewRowFormatting events are fired for all cells/rows. Thus, you can customize the desired cells/ rows. Additional information is available in the following help articles:
4.5. When the AutoSizeRows property is set to true, the row height depends on the content that is displayed in the row. Whether the text will be wrapped or not is controlled by the GridViewColumn.WrapText property.
I hope this information helps. If you have any additional questions, please let me know.
I realized what is the problem with Self-Reference Hierarchy when AutoGenerateColumns property is set to false. The Grid requires "ParentID" and "ID" columns to be specified! This is not documented and confused.
And if you change your code to next view then it will not work (just remved ID and ParentID columns from columns list which is common for most cases in real applications):
The Relations.AddSelfReference method specifies the fields/columns in RadGridView that define the relation. If the grid doesn't contain such columns, it wouldn't be possible to build the hierarchical structure as it wouldn't be possible to determine the parent/child columns relation.
We haven't had similar reports from other customers for the content of the help article. However, we will revise it in order to avoid any further confusion.
I hope this information helps.
Dess | Tech Support Engineer, Sr.