Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Session["userid"] = 1; Session["forumid"] = 1;
            if (!(Convert.ToInt32(Session["userid"]) > 0))
            {
                Response.Redirect("../Pages/Registration.aspx?error=1");
            }
            if (IsPostBack)
            {
                return;
            }

            threadid = Convert.ToInt32(Request.QueryString["threadid"]);
            ForumThread thr = new ForumThread();

            thr.GetThread(threadid);
            List <string> categories = new List <string>();

            categories = ForumCategory.GetPublishedCategoryNames(Convert.ToInt32(Session["forumid"]));
            categories.Insert(0, "Select a category");
            drpCategory.DataSource = categories;
            drpCategory.DataBind();
            if (Request.QueryString["sec"] != null)
            {
                drpCategory.SelectedValue = Request.QueryString["cat"].ToString();
                if (drpCategory.SelectedIndex > 0)
                {
                    drpSection.DataSource = ForumSection.GetAllSectionNames(drpCategory.SelectedItem.Text);
                    drpSection.DataBind();
                    drpSection.SelectedValue = sec = Request.QueryString["sec"].ToString();
                }
                else
                {
                    drpSection.Items.Clear();
                    drpSection.Items.Add("Select a section");
                }
            }
            if (thr != null)
            {
                txtTitle.Text   = thr.ThreadTitle;
                txtContent.Text = thr.ThreadBody;
                if (thr.Published == 1)
                {
                    drpPublish.SelectedIndex = 0;
                }
                else
                {
                    drpPublish.SelectedIndex = 1;
                }
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!(Convert.ToInt32(Session["userid"]) > 0))
            {
                Response.Redirect("../Pages/Registration.aspx");
            }
            if (IsPostBack)
            {
                return;
            }

            reply_pages = 1;
            NReplies    = new List <ForumReply>();
            int threadid = Convert.ToInt32(Request.QueryString["threadid"]);

            section  = Request.QueryString["section"];
            category = Request.QueryString["category"];
            reply    = Request.QueryString["reply"];
            thr      = new ForumThread();
            thr.GetThread(threadid);
            NReplies = thr.GetNReplies(Convert.ToInt32(reply), 10);
        }