没有分页的,只有一页。跟这个</th></tr><tr>不知道有么有关系的

解决方案 »

  1.   

    看看转换后的HTML代码
    <table>
    <thead>ggggggggggggg</thead>
    <tbody>ggggggggggg</tbody>
    </table>是这个格式的吗!
      

  2.   


    TableCell tcell = new TableCell();
    //...
    tcell.Text = "Test";
    tcHeader.Add(tcell);改成这样看可以吗?
      

  3.   

    不明白楼主你想把表头画成什么样子啊?你说“第三行表头是在asp.net里写的”,意思就是protected void gdvAccountInfo_RowCreated(object sender, GridViewRowEventArgs e){……}里的是第一,二行表头,但是第三行表头是在ASPX文件里写的吗?tcHeader.Clear();为什么要注释掉呢,不清空表头的话会出问题的,经常会出现后面多出空列来,一般的做法是全部写在CS文件里,前台的ASPX文件里的<asp:BoundField DataField="CompanyName" HeaderText="公司名" SortExpression="CompanyName" Visible = true>  
    <HeaderStyle Wrap="False" CssClass="grid_head_word" />
    <ItemStyle Wrap="False" CssClass="grid_item_word" />
    </asp:BoundField>
    之类的只是定义数据字段名和相关的其他属性字段,并不会在页面中显示出来。你应该在protected void gdvAccountInfo_RowCreated(object sender, GridViewRowEventArgs e){……tcHeader.Add(new TableHeaderCell());
      //tcHeader[5].Attributes.Add("bgcolor", "DarkSeaGreen");
      tcHeader[5].Attributes.Add("rowspan", "1");
      tcHeader[5].Attributes.Add("colspan", "4");
      tcHeader[5].Text = "业务权限</th></tr><tr>";
      break;
      }
    }
    这个tcHeader[5]继续把第三行的表头写出来的,</th></tr><tr>就是换行,表示这个表头是当前行的最后一个表头(并非列,你这里表头5有1行4列),你在后面再写15个单行单列表头,还有第一个表头应该是tcHeader[0].Text ="公司名"对吧?
      

  4.   

    上面的“这个tcHeader[5]继续把第三行的表头写出来的”应该是“这个tcHeader[5]后面继续把第三行的表头写出来的”,也就是
    protected void gdvAccountInfo_RowCreated(object sender, GridViewRowEventArgs e){……tcHeader.Add(new TableHeaderCell());
      //tcHeader[5].Attributes.Add("bgcolor", "DarkSeaGreen");
      tcHeader[5].Attributes.Add("rowspan", "1");
      tcHeader[5].Attributes.Add("colspan", "4");
      tcHeader[5].Text = "业务权限</th></tr><tr>";
      }
    tcHeader.Add(new TableHeaderCell());
      //tcHeader[6].Attributes.Add("bgcolor", "DarkSeaGreen");
      tcHeader[6].Attributes.Add("rowspan", "1");
      tcHeader[6].Attributes.Add("colspan", "4");
      tcHeader[6].Text = "xxxxxx";
    ……
      }
    }
    这样。
      

  5.   

    排序?你不是有SortExpression吗?还是说你的gridview列的前后次序能根据你要求变化?
      

  6.   

    我定义的三层表头,前两层表头点击一下不需要排序的,但是第三层表头,点击一下要实现排序的功能。现在我知道为什么第三层表头,前面五个列的表头不显示了。是跟gdvAccountInfo_RowCreated里定义了多少tcHeader有关。因为我这里定义了五个,就有五个不显示。我式了下。我定义一个的话。第三层表头只有一个没有显示出来。