Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / July 2007

Tip: Looking for answers? Try searching our database.

Filling dropdownlist from two sources - XML & webservice

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dotnetdev - 17 Jul 2007 16:22 GMT
Hi Friends,

Please need your help in solving this issue.

I have a dropdown list which is connected to an XML file and it has another
connection(secondary datasource) which actually have the data is a web
service.

My connection names are "MainDS" - connection to xml file & secDS -
connection to web service.

I need to fill the drop down list. I tried this code. I get Null reference
error.

XPathNavigator mainnav = MainDataSource.CreateNavigator();
XPathNavigator myname1 =

mainnav.SelectSingleNode(""dfs:myFields/dfs:dataFields/s0:GetUserCollectionFromSiteREsponse/s0:GEtUserCollectionFromSiteResult/s0:GetUserCollectionFromSite/s0:Users/s0:User", NamspaceManager);
//XPathNavigator myname1 =
mainnav.SelectSingleNode("/my:myfields/my:myField1", NamspaceManager);

XPathNavigator secds = this.DataSources["Users"].CreateNavigator();
XPathnavigator myname2 =

secds.SelectSingleNode("dfs:myFields/dfs:dataFields/s0:GetUserCollectionFromSiteREsponse/s0:GEtUserCollectionFromSiteResult/s0:GetUserCollectionFromSite);

myname1.InnerXML = myname2.InnerXML();

where dfs:...... is XPath of the corresponding datasources.

I got a NullReference error. Please help me. I'm in urgent need of it.
Note: Even tried the commented code instead of the code above that. Even
that returned null reference.

Please help
Thanks in advance
Shiva (GGK Tech) - 18 Jul 2007 06:46 GMT
Hi

In the InfoPath 2007 managed object model, you can reference the XML for a
secondary data source from the form code-behind using the syntax:

XPathNavigator node = this.DataSources["MainDS"].CreateNavigator();

For the main data source, use:

XPathNavigator node = this.MainDataSource.CreateNavigator();

The XPathNavigator instance is initially positioned to the document-level
node in the data source XML.

And ‘dfs’ is namespace prefix.
Signature

Shiva
http://www.ggktech.com

> Hi Friends,
>
[quoted text clipped - 32 lines]
> Please help
> Thanks in advance
Dotnetdev - 20 Jul 2007 16:06 GMT
Hi,

i tried the following code: I'm i right. I got the same error.

XPathNavigator mainnav = this.MainDataSource.CreateNavigator();
XPathNavigator myname1 =
mainnav.SelectSingleNode(""dfs:myFields/dfs:dataFields/s0:GetUserCollectionFromSiteREsponse/s0:GEtUserCollectionFromSiteResult/s0:GetUserCollectionFromSite/s0:Users/s0:User", NamspaceManager);
XPathNavigator secds = this.DataSources["Users"].CreateNavigator();
XPathnavigator myname2 =
secds.SelectSingleNode("dfs:myFields/dfs:dataFields/s0:GetUserCollectionFromSiteREsponse/s0:GEtUserCollectionFromSiteResult/s0:GetUserCollectionFromSite);
myname1.InnerXML = myname2.InnerXML();

Still I'm getting the null reference error. It says in the last line of
code(myname1.InnerXML = myname2.InnerXML();) - object reference not set to an
instance of an object.

Please help
Thanks

> Hi
>
[quoted text clipped - 48 lines]
> > Please help
> > Thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.