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
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