protected void btnChangePaging_Click(object sender, EventArgs e) { EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage); List<ISTAT.Entity.AgencyScheme> lAgencyscheme = eMapper.GetAgencySchemeList(_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.GeneralAgencyschemeGridNumberRow; txtNumberOfRows.Text = Utils.GeneralAgencyschemeGridNumberRow.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.GeneralAgencyschemeGridNumberRow; txtNumberOfRows.Text = Utils.GeneralAgencyschemeGridNumberRow.ToString(); } gridView.DataSourceID = null; gridView.DataSource = lAgencyscheme; gridView.DataBind(); }
protected void btnChangePaging_Click(object sender, EventArgs e) { IAgencySchemeMutableObject agencyScheme = GetAgencySchemeFromSession(); if (agencyScheme == null) return; EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage); List<ISTAT.Entity.AgencyScheme> lConceptscheme = eMapper.GetAgencySchemeList(_sdmxObjects); IList<Agency> lAgencySchemeItem = new List<Agency>(); foreach (IAgency agency in agencyScheme.ImmutableInstance.Items) { lAgencySchemeItem.Add(new Agency(agency.Id, _localizedUtils.GetNameableName(agency), _localizedUtils.GetNameableDescription(agency))); } int numberOfRows = 0; if ( !txtNumberOfRows.Text.Trim().Equals( string.Empty ) && int.TryParse( txtNumberOfRows.Text, out numberOfRows ) ) { if ( numberOfRows > 0 ) { gvAgencyschemesItem.PageSize = numberOfRows; } else { gvAgencyschemesItem.PageSize = Utils.DetailsAgencyschemeGridNumberRow; txtNumberOfRows.Text = Utils.DetailsAgencyschemeGridNumberRow.ToString(); } } else if ( !txtNumberOfRows.Text.Trim().Equals( string.Empty ) && !int.TryParse( txtNumberOfRows.Text, out numberOfRows ) ) { Utils.ShowDialog( Resources.Messages.err_wrong_rows_number_pagination ); Utils.AppendScript( "location.href='#agencies';" ); return; } else if ( txtNumberOfRows.Text.Trim().Equals( string.Empty ) ) { gvAgencyschemesItem.PageSize = Utils.DetailsAgencyschemeGridNumberRow; txtNumberOfRows.Text = Utils.DetailsAgencyschemeGridNumberRow.ToString(); } gvAgencyschemesItem.DataSource = lAgencySchemeItem; gvAgencyschemesItem.DataBind(); Utils.AppendScript( "location.href='#agencies';" ); }
private void BindData() { EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage); List<ISTAT.Entity.AgencyScheme> _list = eMapper.GetAgencySchemeList(_sdmxObjects, Utils.LocalizedLanguage); int numberOfRows = 0; if ( !txtNumberOfRows.Text.Trim().Equals( string.Empty ) && int.TryParse( txtNumberOfRows.Text, out numberOfRows ) ) { gridView.PageSize = numberOfRows; } else { gridView.PageSize = Utils.GeneralAgencyschemeGridNumberRow; } lblNumberOfTotalElements.Text = string.Format( Resources.Messages.lbl_number_of_total_rows, _list.Count.ToString() ); if ( _list.Count == 0 ) { lblNumberOfRows.Visible = false; txtNumberOfRows.Visible = false; btnChangePaging.Visible = false; } else { lblNumberOfRows.Visible = true; txtNumberOfRows.Visible = true; btnChangePaging.Visible = true; } gridView.DataSourceID = null; gridView.DataSource = _list; gridView.DataBind(); }
protected void OnSorting(object sender, GridViewSortEventArgs e) { EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage); List<ISTAT.Entity.AgencyScheme> _list = eMapper.GetAgencySchemeList(_sdmxObjects); if ((SortDirection)ViewState["SortExpr"] == SortDirection.Ascending) { _list = _list.OrderBy(x => TypeHelper.GetPropertyValue(x, e.SortExpression)).Reverse().ToList(); ViewState["SortExpr"] = SortDirection.Descending; } else { _list = _list.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.GeneralAgencyschemeGridNumberRow; } gridView.DataSourceID = null; gridView.DataSource = _list; gridView.DataBind(); }