Insert into Data into Repeating Section via Code Behind - Please

S

Simon

Hi All,

I'm having a problem getting my data to appear when I add an entry to
the repeating section using code behind. If anyone could help I would be
eternally greatful!

I have a section that looks like this

<my:Actions>
<my:Action>
<my:ActionName></my:ActionName>
<my:Description></my:Description>
<my:personResponsible></my:personResponsible>
<my:DueDate xsi:nil="true"></my:DueDate>
</my:Action>
</my:Actions>

I can programatically add as many "my:action" entries as I want. The
problem is that although when I do this, the controls appear in the
document, they don't contain the *values* that I've given the
corresponding elements. So for example if I were to successfully add an
<my:ActionName>Arrange meeting with local authority</my:ActionName>
element, a text box would appear for the ActionName element but it won't
display the text "Arrange meeting with local authority". The document
*definately* has that data in it because when I save the doc and look at
the XML directly the saved file has the elements AND the values.

Can anyone tell me what I need to do to get the data to display?

I'm hoping there's a refresh method or something that I need to call,
but I don't understand why the UI structure would automatically update
but not display the actual data in the elements!

Any help would be very much appreciated
Best Regards

Simon

PS: I've attached the pertinent code where I add the action below:




******************************************************************



actionsNode = document.DOM.selectSingleNode("//my:Actions");

# region [-- Build a New Action Node --]

// Initialise the action node and attach all related data as single
elements underneath
actionNode = document.DOM.createNode(1, "my:Action",
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-11-08T11:17:30");

// Create and attach the "ActionName" node
childNode = document.DOM.createNode(1, "my:ActionName",
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-11-08T11:17:30");
childNode.nodeTypedValue = name;

actionNode.appendChild(childNode);

// Create and attach the "Description" node
childNode = document.DOM.createNode(1, "my:Description",
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-11-08T11:17:30");
childNode.text = description;

actionNode.appendChild(childNode);

// Create and attach the "PersonResponsible" node
childNode = document.DOM.createNode(1, "my:personResponsible",
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-11-08T11:17:30");
childNode.text = personResponsible;

actionNode.appendChild(childNode);

// Create and attach the "DueDate" node
childNode = document.DOM.createNode(1, "my:DueDate",
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-11-08T11:17:30");
childNode.text = dueDate.Date.ToString();

actionNode.appendChild(childNode);

# endregion

// Attach the new node to the 'actions' node
actionsNode.appendChild(actionNode);

document.View.EnableAutoUpdate();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top