Ejemplo n.º 1
0
    protected void DdlPageRefreshSelectedIndexChanged(object sender, EventArgs e)
    {
        //store the variable in a cookie.
        SnitzCookie.SetActiveRefresh(ddlPageRefresh.SelectedIndex.ToString());

        if (ddlPageRefresh.SelectedIndex == 0)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "clearrefresh", "cancelRefresh();", true);
        }
        else if (ddlPageRefresh.SelectedValue != null)
        {
            int reloadTime = 60000 * Convert.ToInt32(ddlPageRefresh.SelectedValue);
            if (reloadTime > 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "refresh", "setRefresh('" + reloadTime + "');", true);
            }
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {
            string postbackbtn = Request.Form["__EVENTTARGET"];
            string argument    = Request.Form["__EVENTARGUMENT"];
            int    id;
            switch (postbackbtn)
            {
            case "LockTopic":
                id = Convert.ToInt32(argument);
                LockTopic(id);
                break;

            case "UnLockTopic":
                id = Convert.ToInt32(argument);
                UnLockTopic(id);
                break;

            case "DeleteTopic":
                id = Convert.ToInt32(argument);
                DeleteTopic(id);
                break;
            }
        }
        if (!Page.IsPostBack)
        {
            hdnLastOpened.Value = DateTime.UtcNow.ToForumDateStr();
            Session["FORUM"]    = "";
            lblHotTopic.Text    = string.Format(webResources.lblHotTopics, Config.HotTopicNum);
        }
        if (ddlPageRefresh.SelectedIndex == 0)
        {
            SnitzCookie.SetActiveRefresh("0");
            ScriptManager.RegisterStartupScript(this, GetType(), "clearrefresh", "cancelRefresh();", true);
        }
        BindActiveTopics();
    }