`
javatoyou
  • 浏览: 1020235 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

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);
}
}
}


代码需要整理下再用
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics