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["questionCategoryID"]))
            {
                question_category_id = Convert.ToInt32(Request.QueryString["questionCategoryID"]);
                qLrn_QuestionCategory category = new qLrn_QuestionCategory(question_category_id);
                category.Name = txtTitle.Text;
                category.LastModified = DateTime.Now;
                category.LastModifiedBy = user_id;
                category.Available = rblAvailable.SelectedValue;
                category.Update();
            }
            else
            {
                qLrn_QuestionCategory category = new qLrn_QuestionCategory();
                category.ScopeID = 1;
                category.Created = DateTime.Now;
                category.CreatedBy = user_id;
                category.LastModified = DateTime.Now;
                category.LastModifiedBy = user_id;
                category.Available = "Yes";
                category.MarkAsDelete = 0;
                category.Name = txtTitle.Text;
                category.LastModified = DateTime.Now;
                category.LastModifiedBy = user_id;
                category.Available = rblAvailable.SelectedValue;
                category.Insert();

                question_category_id = category.QuestionCategoryID;
            }

            string user_name = (new qPtl_User(user_id)).UserName;

            if (!String.IsNullOrEmpty(Request.QueryString["questionCategoryID"]))
            {
                lblMessage.Text = "*** Record Successfully Updated ***";
                lblMessageBottom.Text = "*** Record Successfully Updated ***";
                if (Request.QueryString["edit-mode"] == "in-place")
                    Response.Redirect(Request.QueryString["returnURL"]);
                else
                    Response.Redirect("question-category-list.aspx");
            }
            else
            {
                //Response.Redirect(Request.Url.ToString() + "?mode=add-successful&questionCategoryID=" + tip_id);
                Response.Redirect("question-category-list.aspx");
            }
        }
    }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        question_category_id = Convert.ToInt32(Request.QueryString["questionCategoryID"]);
        qLrn_QuestionCategory category = new qLrn_QuestionCategory(question_category_id);
        category.Available = "No";
        category.MarkAsDelete = 1;
        category.Update();

        if (Request.QueryString["edit-mode"] == "in-place")
            Response.Redirect(Request.QueryString["returnURL"]);
        else
            Response.Redirect("question-category-list.aspx");
    }