Пример #1
0
        protected override object GetValue(int rowIndex)
        {
            if (string.IsNullOrEmpty(stringValue))
            {
                if (OwningRow.Index < 0)
                {
                    return string.Empty;
                }

                tableAdaptor = (MySqlTableAdaptor)OwningColumn.Tag;

                var poinedRows = new List<DataRow>();
                if (((DataRowView)OwningRow.DataBoundItem).Row[ColumnIndex + 1] != DBNull.Value)
                {
                    poinedRows = tableAdaptor.GetObjectByIDs(new List<decimal> { (decimal)((DataRowView)OwningRow.DataBoundItem).Row[ColumnIndex + 1] });
                }

                // Advanced
                string result = poinedRows.Aggregate(string.Empty, (current, dr) => current + (", " + dr["NAME"]));

                if (result.Length > 2)
                {
                    stringValue = result.Substring(2);
                }
            }
            return stringValue;
        }