1,627 questions

3,174 answers


477 users

Need to Put Collection Field Info in Add Form CLR

0 votes

I have the following collection field on a CLR Add form

  <c:FormField FieldID="DONORINFO" DataType="XML" Required="true" Caption="Constituent" >
        <c:FormField FieldID="DONORID" DataType="Guid" Caption="Name/PID"    Required="true"  ReadOnly="false" >
          <c:SearchList EnableQuickFind="true" SearchListID="FDF9D631-5277-4300-80B3-FDF5FB8850EC">
              <c:FormFieldOverride FieldID ="DONORID"   DefaultValueText="false"/>

I am not able to get the GUID values for donors and then use it in the form behind. I get an error,
"Value cannot be null - parameter name elementType"

I have tried different data types in the CLR.
Public DONORINFO as Guid
Public DONORINFO as String
Public DONORINFO As Xml.XmlNameTable

How can I read the values in the XML collection field and then loop through them to save records? Thanks!

asked Aug 1 by lynnem (134 points)   1 5 9

1 Answer

0 votes

I always create an object and use that. For instance.

Public Class DonorInfo
    Public Property DONORID As Guid
End Class

Then in the add form's code behind you have this.

Public DONORINFO As DonorInfo()

You don't have to use strongly type classes, but it helps.

answered Aug 1 by chriswhisenhunt (3,803 points)   8 23 43

I tried using a class as you have above. I have also used "object" and "collection" but that did not work either. Perhaps form collection fields are just not allowed in CLR forms. I get the same error:
"Value cannot be null - parameter name elementType"

Hmm....sounds like something is wrong then. I've done this many times for a very long time and never had issues. Wrap up the project and email it to me.