日期:2014-05-18  浏览次数:20408 次

100分,还是扩展GridView的问题,请Jinglecat(晓风残月 等各位帮忙
昨天排序的问题已经解决,今天在照着做个性分页的时候又有点问题

分页功能可以实现,但是上面新加入的导航条,并不是占满整个GridVieew的宽度,而是占满了第一个字段的宽度,我想可能是通过在创建子控件的方式,添加到GridView时某一处的问题

作者的文章地址
http://www.cnblogs.com/jillzhang/archive/2007/06/12/779934.html

下面是该方法的重写代码

protected   override   int   CreateChildControls(System.Collections.IEnumerable   dataSource,   bool   dataBinding)
{
        int   res   =   base.CreateChildControls(dataSource,   dataBinding);
        if   (ShowToolBar)
        {
                try
                {
                        GridViewRow   row   =   new   GridViewRow(0,   0,   DataControlRowType.Pager,   DataControlRowState.Normal);
                        TableCell   c   =   new   TableCell();
                        c.Width   =   Unit.Percentage(100);
                        c.ColumnSpan   =   this.Columns.Count;
                        row.Cells.Add(c);
                        TableCell   cell1   =   new   TableCell();
                        Table   table   =   new   Table();
                        TableRow   r   =   new   TableRow();
                        table.Rows.Add(r);
                        table.Width   =   Unit.Percentage(100);
                        c.Controls.Add(table);
                        r.Cells.Add(cell1);
                        Literal   l1   =   new   Literal();
                        l1.Text   =   "页次: ";
                        cell1.Controls.Add(l1);
                        cell1.Wrap   =   false;
                        cell1.Controls.Add(lblCurrentPage);
                        l1   =   new   Literal();
                        l1.Text   =   "页/ ";
                        cell1.Controls.Add(l1);
                        cell1.Controls.Add(lblPageCount);