This is a migrated thread and some comments may be shown as answers.

Dynamically Create Fields

1 Answer 136 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
heavywoody
Top achievements
Rank 1
heavywoody asked on 19 Mar 2011, 03:03 AM
I love the new DataForm!  What I would like to be able to do is do what I do in the DataGrid, which is I create all the fields at runtime and the headers, then I bind the data.  I see in the examples, it shows to create a DataTemplate.  I guess I could create a DataTemplate at runtime and bind.  But is there another way?  Basically, when I send an entity to the DataForm (or DataGrid), I read the Column information from a SQL Table as to what the label is, what data type, etc.

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 24 Mar 2011, 10:42 AM
Hello Christian Loepp,

I believe the best approach here would be to let RadDataform autogenerate the fields based on your Items Source.  Since you mention you need to adjust properties of fields ( such as label ) we have provided a place to do that - the AutoGeneratingField event .

Within the event handler you may do additional settings and even cancel the field if you do not need it.

Kind regards,
Pavel Pavlov
the Telerik team
Tags
DataForm
Asked by
heavywoody
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or