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;

        }
        protected void SearchMethod()
        {
            tb.Clear();
            sr = new WcfServiceLib.Service1();
            List<Post> lp = sr.findPosts(Search.Text);

            foreach (Post p in lp)
            {

                createTable(p.Type, p.Details, p.Price, p.PhoneNr, p.Address, p.PostalCode, p.Expiration, p.IsReserved, p.Id);
            }


            Gv1.DataSource = tb;
            Gv1.DataBind();
            ViewState["table1"] = tb;
        }
 public List<Post> FindPosts(string type)
 {
     WcfServiceLib.Service1 service = new WcfServiceLib.Service1();
     return service.findPosts(type);
 }
 public List<Post> GetAll()
 {
     WcfServiceLib.Service1 service = new WcfServiceLib.Service1();
     return service.LoadAllPosts();
 }