protected void AddPost(object sender, EventArgs e) { BLOGDB db = new BLOGDB(); BLOGPOST new_post = new BLOGPOST(); new_post.SetPTitle(page_title.Text); new_post.SetPBody(page_body.Text); db.Add_Post(new_post); Response.Redirect("blogarchive.aspx"); }
protected void Page_Load(object sender, EventArgs e) { bloglist_result.InnerHtml = ""; string query = "select * from blog_page"; var db = new BLOGDB(); List <Dictionary <String, String> > rs = db.List_Query(query); foreach (Dictionary <String, String> row in rs) { bloglist_result.InnerHtml += "<div class=\"listitem\">"; string pageid = row["pageid"]; string pagetitle = row["pagetitle"]; bloglist_result.InnerHtml += "<div class\"col2\">" + pagetitle + "</div>"; string pagebody = row["pagebody"]; bloglist_result.InnerHtml += "<div class=\"col2last\">" + pagebody + "</div>"; bloglist_result.InnerHtml += "</div>"; } }