protected void btnChangePaging_Click(object sender, EventArgs e)
 {
     EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage);
         List<ISTAT.Entity.CodeList> lCodelist = eMapper.GetCodeListList(_sdmxObjects);
         int numberOfRows = 0;
         if ( !txtNumberOfRows.Text.Trim().Equals( string.Empty ) && int.TryParse( txtNumberOfRows.Text, out numberOfRows ) )
         {
             if ( numberOfRows > 0 )
             {
                 gridView.PageSize = numberOfRows;
             }
             else
             {
                 gridView.PageSize = Utils.GeneralCodelistGridNumberRow;
                 txtNumberOfRows.Text = Utils.GeneralCodelistGridNumberRow.ToString();
             }
         }
         else if ( !txtNumberOfRows.Text.Trim().Equals( string.Empty ) && !int.TryParse( txtNumberOfRows.Text, out numberOfRows ) )
         {
             Utils.ShowDialog( Resources.Messages.err_wrong_rows_number_pagination );
             return;
         }
         else if ( txtNumberOfRows.Text.Trim().Equals( string.Empty ) )
         {
             gridView.PageSize = Utils.GeneralCodelistGridNumberRow;
             txtNumberOfRows.Text = Utils.GeneralCodelistGridNumberRow.ToString();
         }
         gridView.DataSourceID = null;
         gridView.DataSource = lCodelist;
         gridView.DataBind();
 }
예제 #2
0
        private void BindData()
        {
            EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage);

            List<ISTAT.Entity.CodeList> lCodeList = eMapper.GetCodeListList(_sdmxObjects);

            gvCodelists.PageSize = 12;
            gvCodelists.DataSourceID = null;
            gvCodelists.DataSource = lCodeList;
            gvCodelists.DataBind();
        }
        private void BindData()
        {
            EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage);

            List<ISTAT.Entity.CodeList> lCodeList = eMapper.GetCodeListList(_sdmxObjects,  Utils.LocalizedLanguage);

            lCodeList = lCodeList.FindAll(i => !(new List<string> { "SDMX_H_PERIODS", "SDMX_M_PERIODS", "SDMX_Q_PERIODS" }.Contains(i.ID)));

            int numberOfRows = 0;

            if ( !txtNumberOfRows.Text.Trim().Equals( string.Empty ) && int.TryParse( txtNumberOfRows.Text, out numberOfRows ) )
            {
                gridView.PageSize = numberOfRows;
            }
            else
            {
                gridView.PageSize = Utils.GeneralCodelistGridNumberRow;
            }

            lblNumberOfTotalElements.Text = string.Format( Resources.Messages.lbl_number_of_total_rows, lCodeList.Count.ToString() );
            gridView.DataSourceID = null;
            gridView.DataSource = lCodeList;
            gridView.DataBind();

            if ( lCodeList.Count == 0 )
            {
                txtNumberOfRows.Visible = false;
                lblNumberOfRows.Visible = false;
                btnChangePaging.Visible = false;
            }
            else
            {
                txtNumberOfRows.Visible = true;
                lblNumberOfRows.Visible = true;
                btnChangePaging.Visible = true;
            }
        }
        protected void OnSorting(object sender, GridViewSortEventArgs e)
        {
            EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage);
            List<ISTAT.Entity.CodeList> lCodeList = lCodeList = eMapper.GetCodeListList(_sdmxObjects);

            if ((SortDirection)ViewState["SortExpr"] == SortDirection.Ascending)
            {
                lCodeList = lCodeList.OrderBy(x => TypeHelper.GetPropertyValue(x, e.SortExpression)).Reverse().ToList();
                ViewState["SortExpr"] = SortDirection.Descending;
            }
            else
            {
                lCodeList = lCodeList.OrderBy(x => TypeHelper.GetPropertyValue(x, e.SortExpression)).ToList();
                ViewState["SortExpr"] = SortDirection.Ascending;
            }

            int numberOfRows = 0;

            if ( !txtNumberOfRows.Text.Trim().Equals( string.Empty ) && int.TryParse( txtNumberOfRows.Text, out numberOfRows ) )
            {
                gridView.PageSize = numberOfRows;
            }
            else
            {
                gridView.PageSize = Utils.GeneralCodelistGridNumberRow;
            }
            gridView.DataSourceID = null;
            gridView.DataSource = lCodeList;
            gridView.DataBind();
        }