protected HtmlGenericControl CreateRepositoryDiv(GithubRepo repo) { HtmlGenericControl div = new HtmlGenericControl("div"); div.Attributes["class"] = "resultDiv"; div.Attributes["class"] = "col-sm-4"; HtmlGenericControl textbox = new HtmlGenericControl("tb"); textbox.InnerText = repo.name; textbox.Attributes["class"] = "resultName"; System.Web.UI.HtmlControls.HtmlImage ownerImg = new HtmlImage(); ownerImg.Src = repo.owner.avatar_url; ownerImg.Attributes["class"] = "ownerImg"; Button btn_bookmark = new Button(); btn_bookmark.ID = repo.id.ToString(); btn_bookmark.Text = "Bookmark"; btn_bookmark.Click += RemoveFromBookmarks; btn_bookmark.BackColor = BookmarkColor; HtmlGenericControl innerDiv = new HtmlGenericControl("div"); innerDiv.Controls.Add(textbox); div.Controls.Add(innerDiv); div.Controls.Add(ownerImg); div.Controls.Add(btn_bookmark); return(div); }
/// <summary> /// Create the gallery item with the name avatar and bookmark button /// </summary> /// <param name="repo">GithubRepo object with information for the gallery item</param> /// <returns>div with all the gallery item controls</returns> protected HtmlGenericControl CreateRepositoryDiv(GithubRepo repo) { HtmlGenericControl div = new HtmlGenericControl("div"); div.Attributes["class"] = "resultDiv"; div.Attributes["class"] = "col-sm-4"; HtmlGenericControl textbox = new HtmlGenericControl("tb"); textbox.InnerText = repo.name; textbox.Attributes["class"] = "resultName"; System.Web.UI.HtmlControls.HtmlImage ownerImg = new HtmlImage(); ownerImg.Src = repo.owner.avatar_url; ownerImg.Attributes["class"] = "ownerImg"; //button Button btn_bookmark = new Button(); btn_bookmark.ID = repo.id.ToString(); btn_bookmark.Text = "Bookmark"; btn_bookmark.Click += Btn_bookmark_Click; if (CheckIfBookmarked(repo.id)) { btn_bookmark.BackColor = BookmarkColor; } //btn_bookmark.Attributes.Add("onclick", "btn_search_click"); HtmlGenericControl innerDiv = new HtmlGenericControl("div"); innerDiv.Controls.Add(textbox); div.Controls.Add(innerDiv); div.Controls.Add(ownerImg); div.Controls.Add(btn_bookmark); //div_results.Controls.Add(div); return(div); }