private void dgLocations_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            TextBox tbName      = (TextBox)e.Item.FindControl("tbName");
            int     location_id = Int32.Parse(e.Item.Cells[0].Text);
            int     theReturn   = new locationData().UpdateLocation(location_id, tbName.Text);

            dgLocations.ItemUpdated(location_id);
            dgLocations.EditItemIndex = -1;
            ShowList();
        }
        //list support functions
        private void dgLocations_DeleteCommand(object sender, DataGridCommandEventArgs e)
        {
            //ListReport.Delete(Int32.Parse(e.Item.Cells[0].Text));
            //DelLocation
            int location_id = Int32.Parse(e.Item.Cells[0].Text);
            int theReturn   = new locationData().DelLocation(location_id);

            dgLocations.ItemUpdated(location_id);
            dgLocations.EditItemIndex = -1;
            ShowList();
        }
        protected void imgBtnAddRpt_Click(object sender, EventArgs e)
        {
            int newLocation = new locationData().AddBlankLocation();

            ShowList();

            /*
             * if (ddlSelectReport.SelectedValue.ToString() == "2")
             *  Response.Redirect(string.Format("default.aspx?page={0}&reportid=-1", AdvanceListWizardPageIDSetting));
             * else
             *  Response.Redirect(string.Format("default.aspx?page={0}&reportid=-1", ListReportWizardPageIDSetting));
             */
        }
        private void ShowList()
        {
            DataTable DataSource = null;
            //CategoryEnable = (ddlReportCategory.Items.Count > 1);
            //CategoryEnable = false;
            //int listcategoryid = (CategoryEnable ? Int32.Parse(ddlReportCategory.SelectedValue.ToString()) : -1);
            //EditEnabled = CurrentModule.Permissions.Allowed(OperationType.Edit, CurrentUser);
            bool EditEnabled = true;

            //dgLocations.Columns[4].Visible = CategoryEnable;

            //get the DataSource
            //DataSource = new ListData().GetPublicReports(ArenaContext.Current.Organization.OrganizationID, listcategoryid, CurrentPerson.PersonID);
            if (String.IsNullOrEmpty(Request["parentID"]))
            {
                DataSource = new locationData().GetLocationsByParent();
            }
            else
            {
                DataSource = new locationData().GetLocationsByParent(Int32.Parse(Request["parentID"]));
            }

            dgLocations.Columns[5].Visible = true;

            dgLocations.Visible            = true;
            dgLocations.ItemType           = "List";
            dgLocations.ItemBgColor        = CurrentPortalPage.Setting("ItemBgColor", string.Empty, false);
            dgLocations.ItemAltBgColor     = CurrentPortalPage.Setting("ItemAltBgColor", string.Empty, false);
            dgLocations.ItemMouseOverColor = CurrentPortalPage.Setting("ItemMouseOverColor", string.Empty, false);
            dgLocations.AddEnabled         = false;
            dgLocations.AddImageUrl        = "~/images/add_list.gif";
            dgLocations.MoveEnabled        = false;
            dgLocations.DeleteEnabled      = EditEnabled;
            dgLocations.EditEnabled        = EditEnabled;
            dgLocations.MergeEnabled       = false;
            dgLocations.MailEnabled        = false;
            dgLocations.ExportEnabled      = false;
            dgLocations.AllowSorting       = true;
            dgLocations.DataSource         = DataSource;
            dgLocations.DataBind();

            dgLocations.Visible = true;
            lbAdd.Visible       = true;
        }