2013-03-05 94 views
2
List<Person> pList = new List<Person>(); 
      pList.Add(new Person(1, "John", "", "Shields", 29, 'M')); 
      pList.Add(new Person(2, "Mary", "Matthew", "Jacobs", 35, 'F')); 
      pList.Add(new Person(3, "Amber", "Carl", "Agar", 25, 'M')); 
      pList.Add(new Person(4, "Kathy", "", "Berry", 21, 'F')); 
      pList.Add(new Person(5, "Lena", "Ashco", "Bilton", 33, 'F')); 
      pList.Add(new Person(6, "Susanne", "", "Buck", 45, 'F')); 
      pList.Add(new Person(7, "Jim", "", "Brown", 38, 'M')); 
      pList.Add(new Person(8, "Jane", "G", "Hooks", 32, 'F')); 
      pList.Add(new Person(9, "Robert", "", "", 31, 'M')); 
      pList.Add(new Person(10, "Cindy", "Preston", "Fox", 25, 'F')); 
      pList.Add(new Person(11, "Gina", "`enter code here`", "Austin", 27, 'F')); 
      pList.Add(new Person(12, "Joel", "David", "Benson", 33, 'M')); 
      pList.Add(new Person(13, "George", "R", "Douglas", 55, 'M')); 
      pList.Add(new Person(14, "Richard", "", "Banks", 22, 'M')); 
      pList.Add(new Person(15, "Mary", "C", "Shaw", 39, 'F')); 
      gv1.DataSource = pList; 
      gv1.DataBind(); 

我想在gridview中显示选定的字段。如何使用EVAL功能? ALso如何使用DataField属性?绑定COllection到Gridview

+0

你可以把你的'Person'类定义你的问题。 – 2013-03-05 10:39:07

回答