Datagird format
-
How can i format datagrid. i wants to display 5 records per page but if there is only 1 record for display than datagrid consumes same space as previously for 5 records. it looks very bed. how can i eliminate the same. 1 2 3 4 5 page 1.2.3 if there is 1 record than it looks like: 1 page1.2.3 how can i display it in proper format
-
How can i format datagrid. i wants to display 5 records per page but if there is only 1 record for display than datagrid consumes same space as previously for 5 records. it looks very bed. how can i eliminate the same. 1 2 3 4 5 page 1.2.3 if there is 1 record than it looks like: 1 page1.2.3 how can i display it in proper format
Hi there, Am I correct in thinking that you want to remove the paging stuff if there is 1 record in the list? If so, you simply do a checking based on the length of the datasource, then set the DataGrid.AllowPaging property accordingly when you bind the datasource to the control for the first time. For example:
...
bool allowPaging = (list.Count < DataGrid1.PageSize);
DataGrid1.AllowPaging = allowPaging;DataGrid1.DataSource = list;
DataGrid1.DataBind();
... -
Hi there, Am I correct in thinking that you want to remove the paging stuff if there is 1 record in the list? If so, you simply do a checking based on the length of the datasource, then set the DataGrid.AllowPaging property accordingly when you bind the datasource to the control for the first time. For example:
...
bool allowPaging = (list.Count < DataGrid1.PageSize);
DataGrid1.AllowPaging = allowPaging;DataGrid1.DataSource = list;
DataGrid1.DataBind();
...