C#对象属性绑定到Gridview
如题怎么将对象的属性绑定到gridview
public void GetSelectData()
{
Teller_AmountOfWork Teller = new Teller_AmountOfWork();
Teller = Service.Teller_AmountOfWorkServ.Select();
}
对象Teller 有属性 柜员ID 业务量等等
我想知道的是gridview 显示的那个数据怎么绑定上
[解决办法]
namespace WebApplication1{ public partial class _Default : System.Web.UI.Page { public class Teller { public int 柜员ID { get; set; } public int 业务量 { get; set; } } protected void Page_Load(object sender, EventArgs e) { List<Teller> tellers = new List<Teller>(); tellers.Add(new Teller()); tellers.Add(new Teller()); tellers.Add(new Teller()); tellers.Add(new Teller()); GridView1.DataSource = tellers; GridView1.DataBind(); } }}