protected void PopulateCode(int projectID) { int likes, comments, views; DateTime date; var dt = projectclass.View_Project(projectID); // this is where the business code you created gets called // this is how you populate the elements on the front end likes = dt.Rows[0].Field <int>("Likes"); comments = dt.Rows[0].Field <int>("Comments"); views = dt.Rows[0].Field <int>("Views"); date = dt.Rows[0].Field <DateTime>("DateCreated"); string details = $"Likes: {likes} \t Comments: {comments} \t Views:{views} \t\t Date Created: {date.ToString("D")}"; htmlCode.InnerText = dt.Rows[0].Field <string>("HTML"); cssCode.InnerText = dt.Rows[0].Field <string>("CSS"); jsCode.InnerText = dt.Rows[0].Field <string>("JSS"); }
protected void PopulateCode(int projectID) { string likes, comments, views; DateTime date; var dt = projectclass.View_Project(projectID); // this is where the business code you created gets called // this is how you populate the elements on the front end foreach (DataRow row in dt.Rows) { txtName.Text = row["Name"].ToString(); likes = row["Likes"].ToString(); comments = row["Comments"].ToString(); views = row["Views"].ToString(); date = Convert.ToDateTime(row["DateCreated"]); string details = $"Likes: {likes} \t Comments: {comments} \t Views:{views} \t\t Date Created: {date.ToString("D")}"; if (Convert.ToBoolean(row["Enabled"])) { chkVisible.Checked = false; } else { chkVisible.Checked = true; } htmlCode.Text = row["HTML"].ToString(); cssCode.InnerText = row["CSS"].ToString(); jsCode.InnerText = row["JS"].ToString(); lblProjectName.InnerText = row["Name"].ToString(); lblDateCreated.InnerText = date.ToString("D"); lblProjectCreator.InnerText = "\t" + row["Creator"].ToString(); uId = row["UserID"].ToString(); } }