Working with Form Data from Code Behind
I was attempting to retrieve data from the Forms module in code behind. I "invented" this technique because I could not see a way to get the data strongly typed. If there is a way to do this strongly typed it would be far superior to using dynamic. Wanted to get your thoughts on this approach (i.e. using the .NET "dynamic" keyword). Please advise. . . .
Hi Shawn Weisfeld,
Thank you for using our services.
You cannot use strongly typed property names with dynamic fields. What you can do is to set field names for each text box when you add it to your form, see attached image. Then from code you will be able to use this field name to get (GetValue()) or set value (SetValue()):
How do I get all the form fields dynamically. In this case you know the fields. In my case I donot know the fields. There can be 1 field or 10 fields. How do I get all the fields in a form.
You can use TypeDescriptor.GetProperties Method
the Telerik team