Dear all,
I have a browser enabled infopath 2007 form, and I am using code behind it to insert new rows into the repeating table.
I have attached the schema and how I designed the form.
In the code for the Add subgroup 1,
I have:
Dim myNamespace As String = NamespaceManager.LookupNamespace("my")
Using writer As XmlWriter = MainDataSource.CreateNavigator().SelectSingleNode( _"/my:myField/my:Group1/Sub Sub group 1", NamespaceManager).AppendChild()
writer.WriteStartElement(
"Sub group 1", myNamespace)writer.WriteElementString("field 6", myNamespace, 0)
writer.WriteElementString(
"field 7", myNamespace, 0)
writer.WriteEndElement()
writer.Close()
End Using
This code works find and inserts the field as I expect.
For inserting the section group 1, I have:
Dim myNamespace As String = NamespaceManager.LookupNamespace("my")
Using writer As XmlWriter = MainDataSource.CreateNavigator().SelectSingleNode( _"/my:myField/my:Group Group 1/", NamespaceManager).AppendChild()
writer.WriteStartElement(
"Group 1", myNamespace)writer.WriteElementString("field 4", myNamespace, 0)
writer.WriteElementString(
"field 5", myNamespace, 0)
writer.WriteElementString("Sub Sub group 1", myNamespace, "") 'I know this bit might not be correct
writer.WriteEndElement()
writer.Close()
End Using
This one however, inserts only the header based on the poor code i think i wrote for it, but then , if i click the Add sub group 1 button to add the repeating table in this particular section, it only ends up adding it only to the very first one.
Please can anybody help in fining out what the problem is?
Many thanks in advance.