| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1062 人关注过本帖
标题:请问GRIDVIEW怎样固定多层表头
只看楼主 加入收藏
猫色色
Rank: 2
等 级:论坛游民
帖 子:135
专家分:25
注 册:2006-6-8
结帖率:96%
收藏
 问题点数:0 回复次数:1 
请问GRIDVIEW怎样固定多层表头
以前用的固定表头都是网上流行的那种,但是只能固定一层的表头,今天做项目遇到了!3层表头,而且还要固定,小弟在网上查阅了很多资料都还是没有弄好,请教各位大虾,谁做过固定多层表头,请指教一下,
搜索更多相关主题的帖子: 表头 GRIDVIEW 
2010-04-17 13:01
czyzhuo
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:17
帖 子:230
专家分:1459
注 册:2010-3-11
收藏
得分:0 
试试下面这种方法
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            string strTitle = @"<tr><td rowspan = '2'>水源地名称</td>";  //rowspan为跨行数
            strTitle = strTitle + @"<td rowspan ='2'>水源地编码</td>";
            strTitle = strTitle + @"<td rowspan = '2'>输水方式</td>";
            strTitle = strTitle + @"<td rowspan = '2'>是否有调蓄设施</td>";
            strTitle = strTitle + @"<td rowspan ='2'>输水长度</td>";
            strTitle = strTitle + @"<td colspan ='6' align = 'center'>净水厂处理工艺</td></tr>"; //colspan为跨列数
            strTitle = strTitle + @" <td>沉淀</td>";
            strTitle = strTitle + @"<td>过滤</td>";
            strTitle = strTitle + @"<td>消毒</td>";
            strTitle = strTitle + @"<td>强化深度处理</td>";
            strTitle = strTitle + @"<td>含藻水特殊处理工艺</td>";
            strTitle = strTitle + @"<td>其他</td></tr>";

            TableCellCollection tcHeader = e.Row.Cells;
            tcHeader.Clear();
            tcHeader.Add(new TableCell());
            tcHeader[0].Text = strTitle;

        }
    }

2010-04-21 09:26
快速回复:请问GRIDVIEW怎样固定多层表头
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012967 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved