GridView判断本页的行数,添加空行

判断本页的行数,添加空行
C# code
  
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->
protected void GrvCode_RowCreated( object sender, GridViewRowEventArgs e)
{
int num = 0 ;
num
= GrvCode.Rows.Count;
if (e.Row.RowType == DataControlRowType.Footer)
{
int left = GrvCode.PageSize - num;
int numCol = GrvCode.Rows[ 0 ].Cells.Count;
for ( int i = 0 ;i < left;i ++ )
{
GridViewRow row
=
new GridViewRow( - 1 , - 1 ,DataControlRowType.EmptyDataRow,DataControlRowState.Normal);
for ( int j = 0 ; j < numCol; j ++ )
{
TableCell cell
= new TableCell();
cell.Text
= " &nbsp " ;
row.Cells.Add(cell);
}
GrvCode.Controls[
0 ].Controls.AddAt(num + 1 + i,row);
}
}
}


代码需要整理下再用

你可能感兴趣的:(GridView)