private void SavePage()
        {
            try
            {
                int returnNumber = -1;
                int sortNumber = 0;
                int childPageNumber = -1;
                string pageModID = "0";
                string pageName = txtPageName.Text.Replace("'", "''");
                string pageCaption = txtPageCaption.Text.Replace("'", "''");
                string metaTitle = txtMetaTitle.Text.Replace("'", "''");
                string metaDesc = txtMetaDescription.Text.Replace("'", "''");
                string metaKey = txtMetaKeywords.Text.Replace("'", "''");

                CMSBL cmsBL = new CMSBL();

                if (lblTitle.Text == "Add Page")
                {
                    bool duplicatePage = cmsBL.DuplicatePageName(hdnSiteID.Value, pageName);

                    if (duplicatePage)
                    {
                        lblMessage.Text = "Duplicate Page Name";
                        lblMessage.ForeColor = System.Drawing.Color.Red;
                        return;
                    }
                }

                SqlServer sqlServer = new SqlServer(Util.SqlConnectionString()); ;

                string isPublished = "";
                if (rbYes.Checked)
                    isPublished = "1";
                else if (rbNo.Checked)
                    isPublished = "0";

                //sortNumber = cmsBL.GetDuplicatePageSort(hdnSiteID.Value, hdnPageID.Value, ddlSortNumber.SelectedValue);

                if (sortNumber == 0)
                {
                    childPageNumber = cmsBL.JMD_PAGE_SAVE(hdnChildPageID.Value, hdnSiteName.Value, pageName, pageCaption,
                    metaTitle, metaDesc, metaKey, "",
                    isPublished, "0", "0", "Admin", "Admin", "Admin", "Admin", "Admin", "Admin", "0", "0", "0", "1");

                    if (lblTitle.Text == "Update Page")
                    {
                        DataSet dsPageMod = new DataSet();
                        dsPageMod = sqlServer.JMD_LOAD_MODS(hdnSiteName.Value, pageName);
                        if (dsPageMod.Tables[0].Rows.Count > 0)
                        {
                            DataRow[] dr = dsPageMod.Tables[0].Select("PAGE_NAME='" + pageName + "'");
                            if (dr.Length > 0)
                                pageModID = dr[0]["PAGE_MOD_ID"].ToString();
                        }

                        returnNumber = cmsBL.UpdateTreeview(hdnSiteID.Value, hdnPageID.Value, childPageNumber.ToString(), ddlSortNumber.SelectedValue, _userName);
                    }
                    else
                    {
                        returnNumber = cmsBL.CreateTreeview(hdnSiteID.Value, hdnPageID.Value, childPageNumber.ToString(), ddlSortNumber.SelectedValue, _userName);
                    }

                    sqlServer.JMD_PAGE_MOD_SAVE(pageModID, hdnSiteName.Value, pageName, "7",
                    "Mod_" + pageName, "7", "1", "0", "Admin;Guests;Registered;",
                    "Admin;", "Admin;", "Admin;", "Admin;", "0");

                    if (lblTitle.Text == "Add Page")
                    {
                        lblMessage.Text = "Successfully added the new Page.";
                    }
                    else
                    {
                        lblMessage.Text = "Successfully updated the Page.";
                    }
                    lblMessage.ForeColor = System.Drawing.Color.Green;

                }
                else
                {
                    lblMessage.Text = "Sort Number already exist.";
                    lblMessage.ForeColor = System.Drawing.Color.Red;
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Page Not Updated.";
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }