Hi Julian,
as requested, here is the code for setting up my Master and Child and populating, unbound data (please let me know if you need more info)
I Really need to be able to access the RowIndex Value
thanks
Regards
Steve
as requested, here is the code for setting up my Master and Child and populating, unbound data (please let me know if you need more info)
I Really need to be able to access the RowIndex Value
thanks
Regards
Steve
void CreateUnboundHierarchy()
{
this.radGridView.MasterTemplate.Reset();
SetupMasterForUnbound();
GridViewTemplate ChildTemplate = SetupChildForUnbound();
this.radGridView.Templates.Add(ChildTemplate);
this.radGridView.CreateCell += new GridViewCreateCellEventHandler(radGridView_CreateCell);
//--
ChildTemplate.HierarchyDataProvider = new GridViewEventDataProvider(ChildTemplate);
//this.radGridView.RowSourceNeeded += new GridViewRowSourceNeededEventHandler(radGridView_RowSourceNeeded);
this.radGridView.UserAddingRow += new GridViewRowCancelEventHandler(radGridView_UserAddingRow);
LoadDataForUnbound();
}
void SetupMasterForUnbound()
{
this.radGridView.AllowAutoSizeColumns = true;
this.radGridView.MasterTemplate.AllowAddNewRow = false;
this.radGridView.MasterTemplate.AllowDeleteRow = false;
//-------------
//--
GridViewCheckBoxColumn chk1 = new GridViewCheckBoxColumn("SO");
chk1.HeaderText = "SO";
chk1.ReadOnly = true;
this.radGridView.MasterTemplate.Columns.Add(chk1);
//-------------
//--
GridViewTextBoxColumn textColumn1 = new GridViewTextBoxColumn("ChargeCode");
textColumn1.HeaderText = "ChargeCode";
textColumn1.ReadOnly = true;
this.radGridView.MasterTemplate.Columns.Add(textColumn1);
//--
GridViewTextBoxColumn textColumn2 = new GridViewTextBoxColumn("Description");
textColumn2.HeaderText = "Description";
textColumn2.ReadOnly = true;
this.radGridView.MasterTemplate.Columns.Add(textColumn2);
//--
GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn("UnitCost");
decimalColumn.HeaderText = "UnitCost";
decimalColumn.FormatString = "{0:0.000}";
decimalColumn.ReadOnly = true;
this.radGridView.MasterTemplate.Columns.Add(decimalColumn);
//--
GridViewDecimalColumn decimalColumn1 = new GridViewDecimalColumn("Qty");
decimalColumn1.HeaderText = "Qty";
decimalColumn1.FormatString = "{0:0.000}";
decimalColumn1.ReadOnly = true;
this.radGridView.MasterTemplate.Columns.Add(decimalColumn1);
//--
GridViewDecimalColumn decimalColumn3 = new GridViewDecimalColumn("TotalCost");
decimalColumn3.HeaderText = "TotalCost";
decimalColumn3.FormatString = "{0:0.000}";
decimalColumn3.ReadOnly = true;
this.radGridView.MasterTemplate.Columns.Add(decimalColumn3);
//--
//--
GridViewCheckBoxColumn chk2 = new GridViewCheckBoxColumn("Charge");
chk2.HeaderText = "Charge";
chk2.ReadOnly = true;
this.radGridView.MasterTemplate.Columns.Add(chk2);
//--
GridViewCheckBoxColumn chk3 = new GridViewCheckBoxColumn("Checked");
chk3.HeaderText = "Checked";
chk3.ReadOnly = true;
this.radGridView.MasterTemplate.Columns.Add(chk3);
//--
this.radGridView.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
//----------------------------
}
private GridViewTemplate SetupChildForUnbound()
{
GridViewTemplate template = new GridViewTemplate();
template.AllowAddNewRow = true;
template.AllowDeleteRow = false;
//---------------------------------------------------------------
//---------------------------------------------------------------
GridViewTextBoxColumn editButtonColumn = new GridViewTextBoxColumn();
editButtonColumn.Name = "Edit";
editButtonColumn.FieldName = "Edit";
editButtonColumn.ReadOnly = true;
editButtonColumn.HeaderText = "Edit";
editButtonColumn.Width = 100;
template.Columns.Add(editButtonColumn);
//-----------------------------------------------------------------
// template.Columns.Add(new GridViewCheckBoxColumn("SO"));
GridViewDecimalColumn Num = new GridViewDecimalColumn("Billable");
Num.HeaderText = "Billable";
Num.ReadOnly = true;
Num.IsVisible = false;
template.Columns.Add(Num);
//--
GridViewCheckBoxColumn chk1 = new GridViewCheckBoxColumn("SO");
chk1.HeaderText = "SO";
chk1.ReadOnly = true;
template.Columns.Add(chk1);
//--
GridViewTextBoxColumn textColumn1 = new GridViewTextBoxColumn("ChargeCode");
textColumn1.HeaderText = "ChargeCode";
textColumn1.ReadOnly = true;
template.Columns.Add(textColumn1);
//--
GridViewTextBoxColumn textColumn2 = new GridViewTextBoxColumn("Description");
textColumn2.HeaderText = "Description";
textColumn2.ReadOnly = true;
template.Columns.Add(textColumn2);
//--
GridViewTextBoxColumn textColumn3 = new GridViewTextBoxColumn("Barcode");
textColumn3.HeaderText = "Barcode";
textColumn3.ReadOnly = true;
template.Columns.Add(textColumn3);
//--
GridViewTextBoxColumn textColumn4 = new GridViewTextBoxColumn("Dept");
textColumn4.HeaderText = "Dept";
textColumn4.ReadOnly = true;
template.Columns.Add(textColumn4);
//--
GridViewDateTimeColumn Date1 = new GridViewDateTimeColumn("Date");
Date1.HeaderText = "Date";
Date1.ReadOnly = true;
Date1.FormatString = "{0:d}";
template.Columns.Add(Date1);
//--
GridViewTextBoxColumn textColumn5 = new GridViewTextBoxColumn("Site");
textColumn5.HeaderText = "Site";
textColumn5.ReadOnly = true;
template.Columns.Add(textColumn5);
//--
GridViewDecimalColumn decimalColumn1 = new GridViewDecimalColumn("Qty");
decimalColumn1.HeaderText = "Qty";
decimalColumn1.FormatString = "{0:0.000}";
decimalColumn1.ReadOnly = true;
template.Columns.Add(decimalColumn1);
//--
GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn("UnitCost");
decimalColumn.HeaderText = "UnitCost";
decimalColumn.FormatString = "{0:0.000}";
decimalColumn.ReadOnly = true;
template.Columns.Add(decimalColumn);
//--
GridViewDecimalColumn decimalColumn3 = new GridViewDecimalColumn("TotalCost");
decimalColumn3.HeaderText = "TotalCost";
decimalColumn3.ReadOnly = true;
decimalColumn3.FormatString = "{0:0.000}";
template.Columns.Add(decimalColumn3);
//--
GridViewCheckBoxColumn chk2 = new GridViewCheckBoxColumn("Charge");
chk2.HeaderText = "Charge";
chk2.ReadOnly = true;
template.Columns.Add(chk2);
//--
GridViewCheckBoxColumn chk3 = new GridViewCheckBoxColumn("Checked");
chk3.HeaderText = "Checked";
chk3.ReadOnly = true;
template.Columns.Add(chk3);
//--
template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
return template;
}
void LoadDataForUnbound()
{
using (this.radGridView.DeferRefresh())
{
for (int i = 0; i < dts_DWBillDataSet.sps_BillableGrouped.Count; i++)
{
dts_DWBillDataSet.sps_BillableGroupedRow row = dts_DWBillDataSet.sps_BillableGrouped[i];
this.radGridView.MasterTemplate.Rows.Add(row.SO, row.ChargeCode, row.Description, row.UnitCost, row.Qty, row.TotalCost,row.Charge,row.Checked);
}
}
}