protected void btnChangePaging_Click(object sender, EventArgs e) { EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage); List<ISTAT.Entity.DataFlow> lDataflow = eMapper.GetDataFlowList(_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.GeneralDataflowGridNumberRow; txtNumberOfRows.Text = Utils.GeneralDataflowGridNumberRow.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.GeneralDataflowGridNumberRow; txtNumberOfRows.Text = Utils.GeneralDataflowGridNumberRow.ToString(); } gridView.DataSourceID = null; gridView.DataSource = lDataflow; gridView.DataBind(); }
private void BindData() { EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage); List<ISTAT.Entity.DataFlow> lDF = eMapper.GetDataFlowList(_sdmxObjects); gvDataFlow.PageSize = 35; gvDataFlow.DataSourceID = null; gvDataFlow.DataSource = lDF; gvDataFlow.DataBind(); }
private void BindData() { EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage); List<ISTAT.Entity.DataFlow> _list = eMapper.GetDataFlowList(_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.GeneralDataflowGridNumberRow; } lblNumberOfTotalElements.Text = string.Format( Resources.Messages.lbl_number_of_total_rows, _list.Count.ToString() ); gridView.DataSourceID = null; gridView.DataSource = _list; gridView.DataBind(); if ( _list.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.DataFlow> _list = eMapper.GetDataFlowList(_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.GeneralDataflowGridNumberRow; } gridView.DataSourceID = null; gridView.DataSource = _list; gridView.DataBind(); }