コード例 #1
0
        protected void ListBlogPostMenu(BLOGDB db)
        {
            string query = "select * from blog_post";
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                string blogid = row["blogid"];

                string blogtitle = row["blogtitle"];
                bloglist_result.InnerHtml += "<a href=\"ShowBlogPost.aspx?blogid=" + blogid + "\">" + blogtitle + "</a>";
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bloglist_result.InnerHtml = "";


            string query = "select * from blog_post order by blogid desc";
            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 blogid = row["blogid"];
             *
             *  string blogtitle = row["blogtitle"];
             *  bloglist_result.InnerHtml += "<a href=\"ShowBlogPost.aspx?blogid=" + blogid + "\">" + blogtitle + "</a>";
             *
             *  string blogbody = row["blogbody"];
             *  // bloglist_result.InnerHtml += "<div class=\"col2last\">" + blogbody + "</div>";
             *
             *  bloglist_result.InnerHtml += "</div> ";
             * }*/
            foreach (Dictionary <String, String> row in rs)
            {
                bloglist_result.InnerHtml += "<div class=\"main-post\">";


                string blogid = row["blogid"];

                string blogtitle = row["blogtitle"];
                bloglist_result.InnerHtml += "<h2><a href=\"ShowBlogPost.aspx?blogid=" + blogid + "\">" + blogtitle + "</a></h2>";

                string blogbody = row["blogbody"];
                bloglist_result.InnerHtml += "<p>" + blogbody + "</p>";

                bloglist_result.InnerHtml += "</div>";
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            blogpost_result.InnerHtml = "";

            string searchkey = "";

            if (Page.IsPostBack)
            {
                searchkey = blogpost_search.Text;
            }

            string query = "select * from blog_post";

            if (searchkey != "")
            {
                query += "where blogtitle like '%" + searchkey + "%'";
                query += "where blogbody like '%" + searchkey + "%'";
            }


            var db = new BLOGDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                blogpost_result.InnerHtml += "<div class=\"listitem\">";

                string blogid = row["blogid"];

                string blogtitle = row["blogtitle"];
                blogpost_result.InnerHtml += "<div class=\"col2\"><a href=\"ShowBlogPost.aspx?blogid=" + blogid + "\">" + blogtitle + "</a></div>";

                string blogbody = row["blogbody"];
                blogpost_result.InnerHtml += "<div class=\"col2last\">" + blogbody + "</div>";

                blogpost_result.InnerHtml += "</div>";
            }
        }