Hello, I'm trying to create grid columns types of which I don't know at runtime.
For that I'm using (
I'd like to do something like that..
Any suggestions how can i make this work?
For that I'm using (
GridElement
) class with Dictionary property:public
class
GridElement
{
Dictionary<
string
,
object
> properties =
new
Dictionary<
string
,
object
>();
public
object
this
[
string
name]
{
get
{
if
(properties.ContainsKey(name))
return
properties[name];
return
null
;
}
set
{
properties[name] = value;
}
}
public
Dictionary<
string
,
object
> Properties
{
get
{
return
properties; }
set
{ properties = value; }
}
}
I'd like to do something like that..
List<GridElement> elementList=
new
List<GridElement>();
//Adding some data to elementList
//trying to generate columns
foreach
(var element
in
elementList[0].Properties)
{
GridBoundColumn column =
new
GridBoundColumn();
this
.TestRadGrid.MasterTableView.Columns.Add(column);
column.HeaderText = element.Key.ToString();
column.DataField = ???
}
this
.TestRadGrid.MasterTableView.DataSource = elementList;