开发者

Reset an entire node InfoPath 2007

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 开发者_如何学JAVAa quick way to reset an entire node to its default configuration?

Thanks in Advance!

Matt


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜