Hi
Here is simple solution.
1) Have the person class
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
public string Sex { get; set; }
}
2) Have a static person collection class
public static class PersonCollection
{
private static IList<Person> persons = new List<Person>();
public static void Add(Person person)
{
persons.Add(person);
}
public static IList<Person> GetAll()
{
return persons;
}
}
3) Add a object data source to your aspx page.Click Configure datasource. The choose PersonCollection object as source and click next. In the select tab choose the method 'GetAll'. Finish the configurations.
4) Add a list view to your aspx page. Set the data source. Click configure list view (nothing to change) and then click ok.
5)In the page load event add sample data...
Person person1 = new Person();
person1.Name = "Albin";
person1.Age = 10;
person1.Sex = "Male";
Person person2 = new Person();
person2.Name = "Augustina";
person2.Age = 5;
person2.Sex = "Female";
PersonCollection.Add(person1);
PersonCollection.Add(person2);
Thats all. These new person objects will list in the list view