Pergunta

I have an InfoPath Form built. What I am looking to do is have a reset button that clears and entire node of populated data. I have seen a few solutions out there but this seems like a relatively simple request of a page. Is there a quick way to reset an entire node to its default configuration?

Thanks in Advance!

Matt

Foi útil?

Solução

This seems to have solved it.

private void ClearNode(XPathNavigator nodeToClear)
{
    if (nodeToClear.HasChildren)
    {
        nodeToClear.MoveToFirstChild();
        do
        {
            ClearNode(nodeToClear);
        } while (nodeToClear.MoveToNext());
        nodeToClear.MoveToParent();
    }
    else
    {
        nodeToClear.SetValue(string.Empty);
    }
}

After that you just call whatever node you want cleared and pass it in as an XPathNavigator and away you go. It solved everything I was storing but I am curious how it would handle resetting fields with default values like a boolean or something.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top