protected void declineTradeOffer_click(Object sender, EventArgs e)
 {
     //MainClient.DeclineTradeOffer(Int32.Parse((string)e.CommandArgument));
     //MainClient.AcceptTradeOffer(Int32.Parse(tradeOfferId.Value));
     allYourRecievedTradeOffers = DatabaseInterface.ReadAllTradeOffers(MainClient.player.Name);
     MainClient.AcceptTradeOffer(allYourRecievedTradeOffers.ElementAt(0).Id);
     RenderTradeOffers();
 }
        //protected HtmlGenericControl createDiv(TradeOffer to)
        //{
        //    System.Web.UI.HtmlControls.HtmlGenericControl tradeOffer = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
        //    System.Web.UI.HtmlControls.HtmlGenericControl sellerName = new System.Web.UI.HtmlControls.HtmlGenericControl("p");
        //    sellerName.InnerHtml = "<b>Seller: " + to.SellerName + "</b>";
        //    System.Web.UI.HtmlControls.HtmlGenericControl resP = new System.Web.UI.HtmlControls.HtmlGenericControl("p");
        //    resP.InnerHtml = "<b>You will receive:</b> ";
        //    tradeOffer.Controls.Add(sellerName);
        //    tradeOffer.Controls.Add(resP);
        //    tradeOffer.Attributes.Add("class","tradeOffer");


        //    Dictionary<ResourceType, int> resources = to.SellerResources;


        //    foreach (KeyValuePair<ResourceType, int> r in resources)
        //    {
        //        ResourceType res = r.Key;
        //        int numb = r.Value;
        //        HtmlImage image = new HtmlImage { Src = res.GetImageSrc() };
        //        tradeOffer.Controls.Add(image);
        //        System.Web.UI.WebControls.Label numberOfRes = new System.Web.UI.WebControls.Label();
        //        numberOfRes.Text = numb.ToString() ;
        //        tradeOffer.Controls.Add(numberOfRes);
        //    }

        //    System.Web.UI.HtmlControls.HtmlGenericControl priceP = new System.Web.UI.HtmlControls.HtmlGenericControl("p");
        //    priceP.InnerHtml = "<b>You will have to pay:</b> ";
        //    tradeOffer.Controls.Add(priceP);
        //    Dictionary<ResourceType, int> price = to.ReceiverResources;

        //    foreach (KeyValuePair<ResourceType, int> r in price)
        //    {
        //        ResourceType res = r.Key;
        //        int numb = r.Value;
        //        HtmlImage image = new HtmlImage { Src = res.GetImageSrc() };
        //        tradeOffer.Controls.Add(image);
        //        System.Web.UI.WebControls.Label numberOfRes = new System.Web.UI.WebControls.Label();
        //        numberOfRes.Text = numb.ToString();
        //        tradeOffer.Controls.Add(numberOfRes);
        //    }

        //    System.Web.UI.HtmlControls.HtmlButton acceptButton = new System.Web.UI.HtmlControls.HtmlButton();
        //    acceptButton.InnerText = "Accept";
        //    acceptButton.ID = "a" + to.Id.ToString();
        //    acceptButton.Attributes.Add("runat", "server");
        //    acceptButton.ServerClick += new EventHandler(acceptTradeOffer_click);
        //    acceptButton.Attributes.Add("class", "btn btn-default");
        //    tradeOffer.Controls.Add(acceptButton);

        //    System.Web.UI.HtmlControls.HtmlButton declineButton = new System.Web.UI.HtmlControls.HtmlButton();
        //    declineButton.InnerText = "Decline";
        //    declineButton.ID = "d" + to.Id.ToString();
        //    declineButton.Attributes.Add("runat", "server");
        //    declineButton.ServerClick += new EventHandler(declineTradeOffer_click);
        //    declineButton.Attributes.Add("class", "btn btn-default");
        //    tradeOffer.Controls.Add(declineButton);

        //    return tradeOffer;

        //    //tradeOffer.Attributes.Add("class", "tradeOffer");
        //    //tradeOffer.Style.Add(HtmlTextWriterStyle.BackgroundColor, "gray");
        //    //createDiv.Style.Add(HtmlTextWriterStyle.Color, "Red");
        //    //createDiv.Style.Add(HtmlTextWriterStyle.Height, "100px");
        //    //createDiv.Style.Add(HtmlTextWriterStyle.Width, "400px");
        //    //createDiv.InnerHtml = " I'm a div, from code behind ";
        //    //tradeOffers.Controls.Add(tradeOffer);
        //}



        protected void acceptTradeOffer_click(Object sender, EventArgs e)
        {
            //Button btnTrade = (Button)sender;
            //RepeaterItem item = (RepeaterItem)btnTrade.NamingContainer;
            //var id = item.Controls[0].ID;
            //SNyd
            allYourRecievedTradeOffers = DatabaseInterface.ReadAllTradeOffers(MainClient.player.Name);
            MainClient.AcceptTradeOffer(allYourRecievedTradeOffers.ElementAt(0).Id);
            RenderTradeOffers();
        }