Hello, Dilshod,
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:
DataTable dt =
new
DataTable();
dt.Columns.Add(
"Id"
,
typeof
(Guid));
dt.Columns.Add(
"Name"
,
typeof
(
string
));
dt.Columns.Add(
"ParentId"
,
typeof
(Guid));
Guid id = Guid.NewGuid();
Guid parentId = Guid.NewGuid();
dt.Rows.Add(id,
"Row1"
, parentId);
id = Guid.NewGuid();
dt.Rows.Add(id,
"Row2"
, parentId);
parentId = id;
id = Guid.NewGuid();
dt.Rows.Add(id,
"Row3"
, parentId);
this
.radGridView1.AutoGenerateColumns =
false
;
GridViewTextBoxColumn textBoxColumn =
new
GridViewTextBoxColumn(
"Id"
);
textBoxColumn.FieldName =
"Id"
;
radGridView1.MasterTemplate.Columns.Add(textBoxColumn);
GridViewTextBoxColumn textBoxColumn2 =
new
GridViewTextBoxColumn(
"Name"
);
textBoxColumn2.FieldName =
"Name"
;
radGridView1.MasterTemplate.Columns.Add(textBoxColumn2);
GridViewTextBoxColumn textBoxColumn3 =
new
GridViewTextBoxColumn(
"ParentId"
);
textBoxColumn3.FieldName =
"ParentId"
;
radGridView1.MasterTemplate.Columns.Add(textBoxColumn3);
this
.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
this
.radGridView1.Relations.AddSelfReference(
this
.radGridView1.MasterTemplate,
"Id"
,
"ParentId"
);
this
.radGridView1.DataSource = dt;
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:
https://docs.telerik.com/devtools/winforms/gridview/cells/formatting-cells
https://docs.telerik.com/devtools/winforms/gridview/rows/formatting-rows
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.
Regards,
Dess
Progress Telerik