or
this.radGridView1.Relations.AddSelfReference(this.radGridView1.MasterTemplate, "Id", "ParentId");
Did I do something wrong or is this a known bug?
private
void
OrderHistory_GroupSummaryEvaluate(
object
sender, GroupSummaryEvaluationEventArgs e)
{
decimal
totalRevenue = 0;
foreach
(GridViewRowInfo row
in
e.Group)
{
totalRevenue += (
decimal
)row.Cells[
"RevenueValue"
].Value;
}
e.FormatString = String.Format(
"{0} : £{1:0.00}"
, e.Value, totalRevenue);
}
public ReceiptSplitWizard(String receiptNumber)
{
InitializeComponent();
trustReceivables = new BindingList<
CashReceivable
>();
trustDGV.DataSource = trustReceivables;
trustDGV.CellValidated += new CellValidatedEventHandler(trustDGV_CellValidated);
trustDGV.RowsChanged += new GridViewCollectionChangedEventHandler(trustDGV_RowsChanged);
... foreach loop here to add pre-existing receivables to the binding list to pre-populate it ...
}
void trustDGV_CellValidated(object sender, CellValidatedEventArgs e)
{
if (e.RowIndex == -1)
{
if (e.Column.UniqueName.Equals("trustTargetInvoiceNumberDGVTBC"))
{
CashReceivable receivable = CashReceivable.Clone(originalReceivable);
receivable.TXSet = null;
receivable.BillInvoiceNo = (String)e.Value;
receivable.CheckAmount = null;
receivable.BusinessFunction = GetBusinessFunction(receivable.BillInvoiceNo);
trustReceivables.Add(receivable);
trustDGV.MasterView.TableAddNewRow.CancelAddNewRow();
trustDGV.CurrentRow = trustDGV.Rows[trustDGV.Rows.Count - 1];
trustDGV.CurrentColumn = trustDGV.Columns[1];
}
}
}
void trustDGV_RowsChanged(object sender, GridViewCollectionChangedEventArgs e)
{
GridViewDataRowInfo row = (GridViewDataRowInfo)e.NewItems[0];
CashReceivable receivable = (CashReceivable)row.DataBoundItem;
// if it's been distributed, then gray it out and set it readonly
if (receivable.TXSet != null)
{
foreach (GridViewCellInfo cell in e.GridViewTemplate.Rows[e.NewStartingIndex].Cells)
{
cell.Style.Font = new Font("Segoe UI", 8.25F, FontStyle.Italic);
cell.Style.ForeColor = Color.SlateGray;
cell.ReadOnly = true;
}
}
}