Repeating Table with Generic List<>

P

Paresh

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
 
D

David Dean

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top