protected void btnSave_OnClick(object sender, System.EventArgs e)
    {
        Page.Validate("form");

        if (Page.IsValid)
        {

            int user_id = Convert.ToInt32(Context.Items["UserID"]);

            if (!String.IsNullOrEmpty(Request.QueryString["elementID"]))
            {
                element_id = Convert.ToInt32(Request.QueryString["elementID"]);
                qSoc_Element element = new qSoc_Element(element_id);

                element.ElementType = txtName.Text;
                element.Title = txtSummary.Text;
                element.HTML = reContent.Content;
                element.Available = rblAvailable.SelectedValue;
                element.LastModified = DateTime.Now;
                element.LastModifiedBy = user_id;
                element.Update();
            }
            else
            {
                qSoc_Element element = new qSoc_Element();
                element.ScopeID = 1;
                element.Created = DateTime.Now;
                element.CreatedBy = user_id;
                element.LastModified = DateTime.Now;
                element.LastModifiedBy = user_id;
                element.Available = "Yes";
                element.MarkAsDelete = 0;
                element.Title = txtSummary.Text;
                element.ElementType = txtName.Text;
                element.HTML = reContent.Content;
                element.Available = rblAvailable.SelectedValue;
                element.Highlighted = "Yes";
                element.Insert();

                element_id = element.ElementID;
            }

            // redirect to page to add tip + keywords
            if (!String.IsNullOrEmpty(Request.QueryString["elementID"]))
            {
                lblMessage.Text = "*** Record Successfully Updated ***";
                lblMessageBottom.Text = "*** Record Successfully Updated ***";
            }
            else
            {
                Response.Redirect(Request.Url.ToString() + "?mode=add-successful&elementID=" + element_id);
            }
        }
    }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        element_id = Convert.ToInt32(Request.QueryString["elementID"]);

        qSoc_Element element = new qSoc_Element(element_id);
        element.Available = "No";
        element.MarkAsDelete = 1;
        element.Update();

        Response.Redirect("page-elements-list.aspx");
    }