Completed
Last Updated: 16 Jan 2017 13:26 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 05 Jan 2017 09:12
Category: GridView
Type: Bug Report
0
FIX. RadGridView - header check box is initially checked in a hierarchical grid
To reproduce:

DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("IsActive", typeof(bool));

dt.Rows.Add(1, "Parent1", false);
dt.Rows.Add(2, "Parent2", false);

this.radGridView1.DataSource = dt;
((GridViewCheckBoxColumn)this.radGridView1.MasterTemplate.Columns["IsActive"]).EnableHeaderCheckBox = true;
this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;

DataTable childDataTable = new DataTable();
childDataTable.Columns.Add("Id", typeof(int));
childDataTable.Columns.Add("Title", typeof(string));
childDataTable.Columns.Add("ParentId", typeof(int));            
childDataTable.Columns.Add("IsValid", typeof(bool));
childDataTable.Rows.Add(1, "Child 1", 1, false);
childDataTable.Rows.Add(2, "Child 1", 1, false);
childDataTable.Rows.Add(3, "Child 2", 2, false);
childDataTable.Rows.Add(4, "Child 2", 2, false);

GridViewTemplate template = new GridViewTemplate();
template.DataSource = childDataTable;            
((GridViewCheckBoxColumn)template.Columns["IsValid"]).EnableHeaderCheckBox = true;
radGridView1.MasterTemplate.Templates.Add(template);
template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;

GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate);
relation.ChildTemplate = template;
relation.RelationName = "MasterDeatial";
relation.ParentColumnNames.Add("Id");
relation.ChildColumnNames.Add("ParentId");
radGridView1.Relations.Add(relation);
Attached Files:
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments