Dynamically Create Fields

2 posts, 0 answers
  1. heavywoody
    heavywoody avatar
    81 posts
    Member since:
    Oct 2009

    Posted 18 Mar 2011 Link to this post

    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.
  2. Pavel Pavlov
    Pavel Pavlov avatar
    2039 posts

    Posted 24 Mar 2011 Link to this post

    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
Back to Top