or
// Datasource for Parent Rows
DataTable dtDashboardView_MasterFiles = CDashboardManager.Get_DashboardView_MasterFiles();
// Datasource for Child Rows
DataTable dtDashboardView_SubFiles = CDashboardManager.Get_DashboardView_SubFiles();
// Parent Template Creation
radDashboard.AutoGenerateHierarchy =
true
;
radDashboard.MasterGridViewTemplate.AutoExpandGroups =
true
;
radDashboard.MasterGridViewTemplate.AutoGenerateColumns =
false
;
radDashboard.EnableAlternatingRowColor =
true
;
((GridTableElement)radDashboard.GridElement).AlternatingRowColor = Color.LightGray;
radDashboard.MasterGridViewInfo.TableHeaderRow.AllowResize =
true
;
radDashboard.MasterGridViewTemplate.AllowAddNewRow =
false
;
radDashboard.MasterGridViewTemplate.AllowDeleteRow =
false
;
radDashboard.MasterGridViewTemplate.AllowEditRow =
true
;
PopulateMasterGridColumns();
radDashboard.MasterGridViewTemplate.DataSource = dtDashboardView_MasterFiles;
// Child Template Creation
GridViewTemplate template =
new
GridViewTemplate();
template.Caption =
"SubFiles"
;
template.AutoGenerateColumns =
false
;
template.AllowColumnResize =
true
;
template.AllowRowResize =
false
;
template.AllowAddNewRow =
false
;
template.AllowDeleteRow =
false
;
template.AllowEditRow =
true
;
template.ShowColumnHeaders =
true
;
GridViewCheckBoxColumn dtCheckBox =
new
GridViewCheckBoxColumn();
dtCheckBox.UniqueName =
"c_chkBxSelect"
;
dtCheckBox.HeaderText =
""
;
dtCheckBox.Width = 40;
template.Columns.Add(dtCheckBox);
GridViewTextBoxColumn cMasterID =
new
GridViewTextBoxColumn();
cMasterID.UniqueName =
"c_MASTERID"
;
cMasterID.HeaderText =
"Master ID"
;
cMasterID.FieldName =
"MASTERID"
;
cMasterID.ReadOnly =
true
;
cMasterID.Width = 60;
template.Columns.Add(cMasterID);
GridViewTextBoxColumn cHealthStatus =
new
GridViewTextBoxColumn();
cHealthStatus.UniqueName =
"c_HEALTHSTATUS"
;
cHealthStatus.HeaderText =
"Health Status"
;
cHealthStatus.FieldName =
"HEALTHSTATUS"
;
cHealthStatus.ReadOnly =
true
;
cHealthStatus.Width = 60;
template.Columns.Add(cHealthStatus);
radDashboard.MasterGridViewTemplate.ChildGridViewTemplates.Add(template);
// Establishing Relationship
GridViewRelation relation =
new
GridViewRelation(radDashboard.MasterGridViewTemplate);
relation.ChildTemplate = template;
relation.RelationName =
"MasterSub"
;
relation.ParentColumnNames.Add(
"MASTERID"
);
relation.ChildColumnNames.Add(
"c_MASTERID"
);
radDashboard.Relations.Add(relation);
private
void
PopulateMasterGridColumns()
{
try
{
radDashboard.Columns.Clear();
GridViewCheckBoxColumn dtCheckBox =
new
GridViewCheckBoxColumn();
dtCheckBox.UniqueName =
"chkBxSelect"
;
dtCheckBox.HeaderText =
""
;
radDashboard.MasterGridViewTemplate.Columns.Add(dtCheckBox);
dtCheckBox.Width = 40;
GridViewTextBoxColumn cMasterID =
new
GridViewTextBoxColumn();
cMasterID.UniqueName =
"MASTERID"
;
cMasterID.HeaderText =
"Master ID"
;
cMasterID.FieldName =
"MASTERID"
;
cMasterID.ReadOnly =
true
;
radDashboard.MasterGridViewTemplate.Columns.Add(cMasterID);
cMasterID.Width = 60;
GridViewTextBoxColumn cHealthStatus =
new
GridViewTextBoxColumn();
cHealthStatus.UniqueName =
"HEALTHSTATUS"
;
cHealthStatus.HeaderText =
"Health Status"
;
cHealthStatus.FieldName =
"HEALTHSTATUS"
;
cHealthStatus.ReadOnly =
true
;
radDashboard.MasterGridViewTemplate.Columns.Add(cHealthStatus);
cHealthStatus.Width = 60;
GridViewTextBoxColumn cBranch =
new
GridViewTextBoxColumn();
cBranch.UniqueName =
"BRANCH"
;
cBranch.FieldName =
"BRANCH"
;
cBranch.ReadOnly =
true
;
cBranch.HeaderText =
"Branch"
;
radDashboard.MasterGridViewTemplate.Columns.Add(cBranch);
cBranch.Width = 70;
GridViewTextBoxColumn cDepartment =
new
GridViewTextBoxColumn();
cDepartment.UniqueName =
"DEPARTMENT"
;
cDepartment.FieldName =
"DEPARTMENT"
;
cDepartment.ReadOnly =
true
;
cDepartment.HeaderText =
"Dept"
;
radDashboard.MasterGridViewTemplate.Columns.Add(cDepartment);
cDepartment.Width = 40;
GridViewTextBoxColumn cEditLink =
new
GridViewTextBoxColumn();
cEditLink.UniqueName =
"JOBFILENUMBER"
;
cEditLink.FieldName =
"JOBFILENUMBER"
;
cEditLink.HeaderText =
"Job File"
;
radDashboard.MasterGridViewTemplate.Columns.Add(cEditLink);
cEditLink.ReadOnly =
true
;
cEditLink.Width = 70;
GridViewTextBoxColumn cCustomerName =
new
GridViewTextBoxColumn();
cCustomerName.FieldName =
"CUSTOMER_NAME"
;
cCustomerName.UniqueName =
"CUSTOMERNAME"
;
cCustomerName.HeaderText =
"Customer Name"
;
cCustomerName.ReadOnly =
true
;
radDashboard.MasterGridViewTemplate.Columns.Add(cCustomerName);
cCustomerName.Width = 180;
}
catch
(Exception pobjExc)
{
MessageBox.Show(pobjExc.Message.ToString());
throw
pobjExc;
}
finally
{ }
}