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

Adding fields in code behind

4 Answers 111 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 2
Edward asked on 15 Apr 2012, 07:01 PM
Hi

Is it possible to add fields in code behind?

Thanks,
Edward

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 16 Apr 2012, 09:29 AM
Hi Edward,

Will it be possible to share a bit more details about the exact scenario that  you want to achieve ? When do you want to add a new field to the data form and to which template - read-only template, editable template or the one for inserting new item ? 

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Edward
Top achievements
Rank 2
answered on 16 Apr 2012, 10:13 AM
Okay,

I have a visitor class which has like 20 fields. Sometimes we need a 'visitor light' form entry which exposes only 5 fields.

hmm while I was typing this I could think of 2 solutions:

1. Create two classes in code (normal and light) and switch between them
2. Just create one class with all the fields and cancel them out in the auto generatingField event.

What do you think?
 
0
Accepted
Maya
Telerik team
answered on 16 Apr 2012, 11:12 AM
Hi Edward,

My recommendation would be to follow the second approach - to handle AutoGeneratingField event and cancel those fields that you do not want to be displayed.  

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
EDGAR JIMENEZ
Top achievements
Rank 1
answered on 15 May 2012, 07:36 PM
Maya ,

I need to add fields in the code behind and don't have the option of canceling fields that I don't need. Whats the best way to manually add fields to the data form?

Thanks.
Tags
DataForm
Asked by
Edward
Top achievements
Rank 2
Answers by
Maya
Telerik team
Edward
Top achievements
Rank 2
EDGAR JIMENEZ
Top achievements
Rank 1
Share this question
or