simple c# removeChild question

S

snowchess

Hi,

I'm a newbie to custom code, but i searched the web quite thoroughly
but couldn't find an answer to a fairly siple question, maybe someone
can help me.

While using

node1.parentNode.removeChild(node1);

how can i select the current node1, when it is a row in a repeating
table?

for instance i want to add a delete row button to each infopath table
row, but to make the code delete just the current row (not just the
first child or all childs) i have to show parentNode, which specific
node i want to delete. everyway i tried, i could only delete the first
one or get a reference exception.

for example when /my:myFields/my:parentNode/my:node1 is a repeating row
in a table then

IXMLDOMNode node = e.Source.selectSingleNode("../my:node1");
IXMLDOMNode parent =
thisXDocument.DOM.selectSingleNode("/my:myFields/my:parentNode");
parent.removeChild(node);

does not delete the current row from the table but the first one

thank you in advance,
s.
 
S

S.Y.M. Wong-A-Ton

Try the following in the OnClick event of the button:

e.Source.parentNode.removeChild(e.Source);
 

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