我有一个以List格式返回的Employee记录列表。如何动态填充gridview?
ePremiumSubscriber.Subscriber PremSubData = new ePremiumSubscriber.Subscriber();
List<ePremiumSubscriber.Subscriber> premSubList = new List<ePremiumSubscriber.Subscriber>();
ePremiumCustomerDAL.SearchPremSubscriberData(premSubList, sqlQuery);
DataTable dtSearchResults = new DataTable();
dtSearchResults.Columns.Add("psLastName", System.Type.GetType("System.String"));
dtSearchResults.Columns.Add("psFirstName", System.Type.GetType("System.String"));
答案 0 :(得分:2)
删除一个GridView控件你asp.net页面然后你可以按照他的方式去做
GridView1.DataSource = dtSearchResults ;
GridView1.DataBind();