protected void Page_Load(object sender, EventArgs e) { Gv1.SelectedIndex = -1; sr = new WcfServiceLib.Service1(); List<Post> lp = sr.LoadAllPosts(); tb.Columns.Add("type", typeof(string)); tb.Columns.Add("details", typeof(string)); tb.Columns.Add("price", typeof(string)); tb.Columns.Add("phone", typeof(string)); tb.Columns.Add("address", typeof(string)); tb.Columns.Add("postalCode", typeof(string)); tb.Columns.Add("expiration",typeof(string)); tb.Columns.Add("status", typeof(string)); tb.Columns.Add("id", typeof(int)); foreach (Post p in lp) { createTable(p.Type, p.Details, p.Price, p.PhoneNr, p.Address, p.PostalCode, p.Expiration.Date, p.IsReserved,p.Id); } Gv1.DataSource = tb; Gv1.DataBind(); ViewState["table1"] = tb; }
protected void Page_Load(object sender, EventArgs e) { sr = new WcfServiceLib.Service1(); List<Post> lp = sr.LoadAllPosts(); DataTable table = CreateTable(lp); View1.DataSource = table; View1.DataBind(); //ViewState["table1"] = table; }
public List<Post> GetAll() { WcfServiceLib.Service1 service = new WcfServiceLib.Service1(); return service.LoadAllPosts(); }