Error on Initiation infopath 2007 form:System.InvalidOperationException: Invalid Context: <XPath> event must be registered before this form is deployed. - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Error on Initiation infopath 2007 form:System.InvalidOperationException: Invalid Context: <XPath> event must be registered before this form is deployed.

Last post 05-06-2010 08:12 AM by ManasPandey. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-25-2010 10:49 PM

    Error on Initiation infopath 2007 form:System.InvalidOperationException: Invalid Context: <XPath> event must be registered before this form is deployed.

    Hi,

    I have developed a custom workflow using 32bit machin on VS 2008. It having a Initiation InfoPath form(developed on 64bit) with a textbox named 'toolName'. I have added a event handler by right clicking on textBox and select "programming" then select "changed event". VSTA opened and wrote the follwing code:

    public void InternalStartup() {

    EventManager.FormEvents.Loading += new LoadingEventHandler(FormEvents_Loading);

    EventManager.XmlEvents["/my:myFields/my:toolName"].Changed += new XmlChangedEventHandler(toolName_Changed);

    }

    public void toolName_Changed(object sender, XmlEventArgs e)

    {

    // XPathNavigator myNav = this.MainDataSource.CreateNavigator();

    // myNav.SelectSingleNode("//my:keyword", this.NamespaceManager).SetValue("Keyword");

    }

    I built this and deployed the workflow as feature along with infopath forms on the 64bit machine. When I activate the workflow on the list item, I always get the following error:

    System.InvalidOperationException, mscorlib

    System.InvalidOperationException: Invalid Context: /my:myFields/my:toolName event must be registered before this form is deployed.
    at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventsHost.get_Item(String xpath, String dataObjectName)
    at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventsHost.get_Item(String xpath)
    .......

    I think to register the event handler with the textbox is already done at the method "InternalStartup".

    Please help me why I am getting this error? Is there another way to register the event on InfoPath form?

    Regards,

    Rakesh

  • 05-03-2010 11:56 PM In reply to

    Re: Error on Initiation infopath 2007 form:System.InvalidOperationException: Invalid Context: <XPath> event must be registered before this form is deployed.

     Rakesh, were you able to find the solution?

  • 05-06-2010 08:12 AM In reply to

    Re: Error on Initiation infopath 2007 form:System.InvalidOperationException: Invalid Context: <XPath> event must be registered before this form is deployed.

    It's working for me. Publish the form after making the changes and deploy this published form.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.