datagrid| Page | solve | The problem
DataGrid If you use pagination, the last page may not be "full page" so that the layout of the DataGrid may be problematic, the remaining rows are too wide, and the entire DataGrid becomes ugly.
The solution can probably be considered from three places:
1. Fill in the new data line in the DataSource.
2, fill in the DataGrid with the new blank control row.
3. Fill in the new HTML control line with JavaScript in webpage.
I used the second method, in the response method of the PreRender event of the DataGrid, to fill in a blank line above the footer line, as follows:
for (int j=this. Pagesize+4-table. controls.count;j>0;j--)
{
DGI = new DataGridItem (0,0,listitemtype.item);
for (int i=0;i<tablerow. controls.count;i++)
{
TableCell = new System.Web.UI.WebControls.TableCell ();
Dgi. Cells.add (TableCell);
}
Table. Controls.addat (table. CONTROLS.COUNT-2,DGI);
}
}
Description: Consider here is a header/footer/pager row, pager in the next, bound DataGrid.
The strange thing is, can not be here to add cssstyle to a row, once I dgi.cssstyle= "Dumptablerowclass", these new lines will collapse, a successful friend please enlighten me, thank you.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.