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 / December 2006

Tip: Looking for answers? Try searching our database.

How to programatically add repeated rows ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
stephanperrin@gmail.com - 19 Dec 2006 09:24 GMT
I would like to generate automatically a table with a number rows
depending on a variable ?
Thx !
Andy Bonner - 19 Dec 2006 18:32 GMT
Hi Stephan

You'd want to get hold of the repeating group node, clone it, change the
values, then add it after the original node.

Something along these lines

XPathNavigator repeatingNode =
MainDataSource.CreateNavigator().SelectSingleNode("/my:Example/my:RepeatingNode",
NamespaceManager);
for(int i=1;i<=10;i++)

{

XPathNavigator newNode = repeatingNode.Clone();

newNode.SelectSingleNode("/my:Example/my:RepeatingNode/my:ID",
this.NamespaceManager).SetValue(i.ToString());

newNode.SelectSingleNode/my:Example/my:RepeatingNode/my:Name",
this.NamespaceManager).SetValue("Example " + i.ToString());

try

{

repeatingNode.InsertAfter(newNode);

}

catch (Exception)

{

}

}

repeatingNode.DeleteSelf();

Hope this helps
Andy

>I would like to generate automatically a table with a number rows
> depending on a variable ?
> Thx !

Rate this thread:






 
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.