Hi All,
I would like to instantiate a class object in a repeating table, but I
don't have enough information about how to proceed further :)
I have a class structure as follows:
public class ClassA
{
public ClassA()
{
i = 0;
clsB = getClassBs();
}
int i = 0; // initialised to have default value
public int I
{
get { return i; }
set { i = value; }
}
public List<ClassB> getClassBs()
{
List<ClassB> lst = new List<ClassB>();
for (int i = 0; i < 5; i++)
{
ClassB clsB = new ClassB();
clsB.J = i;
lst.Add(clsB);
}
return lst;
}
}
Then I have written a webservice method to return a list of ClassA as
follows:
[
WebMethod]
public List<ClassA> getClassA()
{
List<ClassA> lst = new List<ClassA>();
ClassA cls = new ClassA();
lst.Add(cls);
return lst;
}
I do get one classA instance which is properly instantiated. However,
when I try click on "Insert an item" od the repeating section / table,
the list only adds the structure of the class. I would like to have
an instantiated classA object added in my view.
Please take a look at what I want to achieve for more clear
understanding. Is it possible that when I click "Insert an Item" link
of the repeating section / table, I can tell my application that take
this instancce of list, create an object of my claass or instantiate
my class object, and add thie instantiated object to the list or
something like that.
Please let me know your views.
Thanks.
Paresh
David Dean - 31 Jul 2007 14:36 GMT
Paresh -
InfoPath controls are not bound to data sources in the same manner as a
WinForms or ASP.NET control. InfoPath controls are visual representations of
XML nodes in the main data source for the form template.
When you add/insert into repeating tables or sections in your form, InfoPath
creates a new XML element in the main data source and initializes it using
the default values that are set within the Properties dialog for the table or
section. You use Rules or event handlers in the form template code to perform
custom processing when a row or section is added.

Signature
David Dean
Sr. Member Technical Staff
Insource Technology Corp.
> Hi All,
>
[quoted text clipped - 80 lines]
>
> Paresh