protected void Page_Load(object sender, EventArgs e) { SC = new Game_ServiceClient(); var game_List = SC.getAllGames(); String strDisplay = ""; foreach (Game g in game_List) { strDisplay += "<div class='game - image'><span class='play'><span class='name'>" + g.Game_Title + "</span></span> <a href = '#' >"; strDisplay += "</div >"; strDisplay += "<div class='game - image'> <img src=" + g.Game_Image + " alt='' /></a> </div>"; strDisplay += "<div class='rating <p>RATING </p>"; strDisplay += " <div class='stars'"; strDisplay += " <div class='stars-in'> "; strDisplay += "</div> </div>"; strDisplay += "<span class='comments'>" + g.Game_Num_Comments + "</span> </div>"; } //game_page.InnerHtml = strDisplay; }
protected void Page_Load(object sender, EventArgs e) { if (true) { //tblData.Rows.Clear(); Games = new List <Game>(SC.getAllGames()); foreach (Game OneGame in Games) { TableRow tr = new TableRow(); TableCell Game_Title = new TableCell(); Game_Title.Text = OneGame.Game_Title; tr.Cells.Add(Game_Title); TableCell Game_Type = new TableCell(); Game_Type.Text = OneGame.Game_Type; tr.Cells.Add(Game_Type); TableCell Game_Rating = new TableCell(); Game_Rating.Text = OneGame.Game_Rating.ToString(); tr.Cells.Add(Game_Rating); TableCell Game_Quantity = new TableCell(); Game_Quantity.Text = OneGame.Game_Quantity.ToString(); tr.Cells.Add(Game_Quantity); TableCell Game_Num_Comments = new TableCell(); Game_Num_Comments.Text = OneGame.Game_Num_Comments.ToString(); tr.Cells.Add(Game_Num_Comments); TableCell Game_Descrp = new TableCell(); Game_Descrp.Text = OneGame.Game_Descrp; tr.Cells.Add(Game_Descrp); //edit AND delete buttons TableCell Editbtn = new TableCell(); Button btnEdit = new Button(); btnEdit.Text = "Edit"; btnEdit.ID = "Edit" + OneGame.Game_Id.ToString(); btnEdit.ControlStyle.CssClass = "button"; btnEdit.Click += new EventHandler(Edit_Click); Editbtn.Controls.Add(btnEdit); tr.Cells.Add(Editbtn); TableCell Deletebtn = new TableCell(); Button btnDelete = new Button(); btnDelete.Text = "Delete"; btnDelete.ID = "Del" + OneGame.Game_Id.ToString(); btnDelete.Click += new EventHandler(Delete_Click); Deletebtn.Controls.Add(btnDelete); tr.Cells.Add(Deletebtn); tblData.Rows.Add(tr); } } }