protected void Page_Load(object sender, EventArgs e) { posts_result.InnerHtml = ""; string searchkey = ""; if (Page.IsPostBack) { searchkey = post_search.Text; } string query = "select * from STUDENTS"; if (searchkey != "") { query += " WHERE page_title like '%" + searchkey + "%' "; query += " or page_body like '%" + searchkey + "%' "; } var db = new PagesDB(); List <Dictionary <String, String> > rs = db.List_Pages(query); foreach (Dictionary <String, String> row in rs) { posts_result.InnerHtml += "<div class=\"listitem\">"; string postid = row["page_id"]; string posttitle = row["page_title"]; posts_result.InnerHtml += "<div><a href=\"ReadPage.aspx?pageid=" + postid + "\">" + posttitle + "</a></div>"; posts_result.InnerHtml += "</div>"; } }
protected void ListPages(PagesDB db) { string query = "select * from pages"; List <Dictionary <String, String> > rs = db.List_Pages(query); foreach (Dictionary <String, String> row in rs) { all_posts.InnerHtml += row["page_title"]; } }