User-330204900 posted
Hi Mark you could use a column generator as used in DD Futures and in my tutorials on permissions:
// add ColumnNameFieldsManager to set column names
GridView1.ColumnsGenerator = new ColumnNameFieldsManager(table);
And here's the Column Generator class
public class ColumnNameFieldsManager : IAutoFieldGenerator
{
protected MetaTable _table;
public ColumnNameFieldsManager(MetaTable table)
{
_table = table;
}
public ICollection GenerateFields(Control control)
{
List<DYNAMICFIELD> oFields = new List<DYNAMICFIELD>();
foreach (MetaColumn column in _table.Columns)
{
// carry on the loop at the next column
// if scaffold table is set to false or DenyRead
if (!column.Scaffold)
continue;
DynamicField f = new DynamicField();
f.DataField = column.Name;
// do your column name look up here
f.HeaderText = "***" + column.Name + "***";
oFields.Add(f);
}
return oFields;
}
}
You could then skip the columns you don't want based on your own attributes
Hope this helps [:D]