Here is my scenario,
I bind my grid with a List of foo.
foo contains a list of bar, which are custom, user defined fields. Each foo has the identical list of bars, but the "Value" of each bar is different, depending on what the user put in.
In my scenario, foo has a list with 2 bars
bar 1 Fieldname="CustomField1"
bar 1 Value="My Field"
bar 2 Fieldname="CustomField2"
bar 2 Value="My Field 2"
My grid will have 5 columns, ID, Name, Desc, CustomField1, CustomField2.
When I bind, ID, Name, Desc populate with data, but of course, CustomField1 and CustomField2 are empty, which I expect.
What is the best way to get the data into these columns?
I hope this isn't too confusing!
Thanks.
Sample Code;
I bind my grid with a List of foo.
foo contains a list of bar, which are custom, user defined fields. Each foo has the identical list of bars, but the "Value" of each bar is different, depending on what the user put in.
In my scenario, foo has a list with 2 bars
bar 1 Fieldname="CustomField1"
bar 1 Value="My Field"
bar 2 Fieldname="CustomField2"
bar 2 Value="My Field 2"
My grid will have 5 columns, ID, Name, Desc, CustomField1, CustomField2.
When I bind, ID, Name, Desc populate with data, but of course, CustomField1 and CustomField2 are empty, which I expect.
What is the best way to get the data into these columns?
I hope this isn't too confusing!
Thanks.
Sample Code;
namespace
sample
{
class
foo
{
public
int
ID {
get
;
set
; }
public
string
Name {
get
;
set
; }
public
string Desc {
get
;
set
; }
private
List<bar> _customFields;
public
foo ()
{
_customFields =
new
List<bar>();
}
}
class
bar
{
public
string
FieldName {
get
;
set
; }
public
string
Value {
get
;
set
; }
}
}