EventManager.XmlEvents["..."].Changed won't work in MOSS ! - InfoPath Dev
in

InfoPath Dev

EventManager.XmlEvents["..."].Changed won't work in MOSS !

Last post 11-04-2008 11:15 PM by davex. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 11-04-2008 11:15 PM

    • davex
    • Not Ranked
    • Joined on 11-04-2008
    • Posts 8

    EventManager.XmlEvents["..."].Changed won't work in MOSS !

    Hello,

     I'm quite new to the world of InfoPath and SharePoint so my apologies if this question sounds a little bit "newbie" !

     I'm making a form that will be integrated to our MOSS 2007 solution. Outside MOSS, in the InfoPath client preview, everything's alright and act like expected. But when I publish/upload my form into MOSS, the event of having modified (change) a datetime form field seems to be not recognized. Here's the code :

    using Microsoft.Office.InfoPath;
    using System;
    using System.Xml;
    using System.Xml.XPath;
    using System.Collections.Generic;
    using System.Text;
    using System.Globalization;

    namespace Demande_Conge
    {
        public partial class FormCode
        {
            public void InternalStartup()
            {
                EventManager.FormEvents.Loading += new LoadingEventHandler(FormEvents_Loading);
                EventManager.XmlEvents["/my:DemandeConge/my:Conges/my:DateFin"].Changed += new XmlChangedEventHandler(DateFin_Changed); <== this event is not recognized as the "DateFin_Changed" function isn't executed.
            }

            public void FormEvents_Loading(object sender, LoadingEventArgs e)
            {
                XPathNavigator MainData = MainDataSource.CreateNavigator();

                MainData.SelectSingleNode("/my:DemandeConge/my:IDDemande", NamespaceManager).SetValue(
                            MainData.SelectSingleNode("/my:DemandeConge/my:Employe", NamespaceManager).Value + "_" + DateTime.Now.ToShortDateString());
               
            }

            public void DateFin_Changed(object sender, XmlEventArgs e)
            {
                XPathNavigator MainData2 = MainDataSource.CreateNavigator();

                DateTime dt1 = MainData2.SelectSingleNode("/my:DemandeConge/my:Conges/my:DateDebut", NamespaceManager).ValueAsDateTime;
                DateTime dt2 = MainData2.SelectSingleNode("/my:DemandeConge/my:Conges/my:DateFin", NamespaceManager).ValueAsDateTime;

                System.TimeSpan span = dt2.Subtract(dt1);

                double final = span.TotalDays;
                string final2 = final.ToString();

                MainData2.SelectSingleNode("/my:DemandeConge/my:Conges/my:Total", NamespaceManager).SetValue(final2);
            }

        }
    }

    So what's wrong in this code ? What annoys me is that it works perfectly outside MOSS... :'(

     Thanks a lot for your help.

     David from Belgium.

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.