Changed Event on group fields throwing exception. - InfoPath Dev
in

InfoPath Dev

Changed Event on group fields throwing exception.

Last post 03-18-2013 04:29 AM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-14-2013 04:29 AM

    Changed Event on group fields throwing exception.

    Hi Experts,

    We are upgrading a Infoapth form from MOSS 2007 to SharePoint 2010. Its a browser form with code behind.

    On opening the form in Sharepoint 2010 there is one warning on loading of the form.

    When we investigated the issue of warnings ULS logs gave following exception when we are setting few control values from code.

    Ex:

    XpathNavigator formVersion = xnDoc.SelectSingleNode(@"/my:myFields/my:field4", this.NamespaceManager);

    formVersion.SetValue(this.Template.Version);

    Just after .Setvalue is called an exception is logged in ULS as below,

    "

    Exception thrown from business logic event listener: System.NullReferenceException: Object reference not set to an instance of an object.   

     at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventExternal.<>c__DisplayClass10.<add_Changed>b__c(Object sender, XmlEventArgs e)   

     at Microsoft.Office.InfoPath.Server.SolutionLifetime.XmlEventExternal.<>c__DisplayClass20.<FireChangedEvent>b__1c()   

     at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.CallFormCodeWithExceptionHandling(UserMessages userMessages, OMCall d)

    "

    Further investigation gave following infomation.

    When the changed event is enabled at top fields level Ex: myFields

    i.e

    EventManager.XmlEvents[

    /my:myFields"].Changed += new XmlChangedEventHandler(myFields_Changed);

    then only above issue is occuring.

    The form works without warnings in MOSS 2007. It only gives error in SharePoint 2010.

    Can anyboy please help on above issue?

     

    Thanks in advance

    Prasad

  • 03-18-2013 04:29 AM In reply to

    Re: Changed Event on group fields throwing exception.

    Where is this code located:

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

    Is it in the place where InfoPath automatically creates lines like this, or have you put it somewhere else?  Could you show us the full content of your myFields_Changed event handler? Perhaps there is another way to accomplish what you are doing.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.