GridView Header 分行
来源:互联网 发布:雅思网络课程百度云 编辑:程序博客网 时间:2024/06/05 22:38
gvGpsData.RowCreated += new GridViewRowEventHandler(gvGpsData_RowCreated);
void gvGpsData_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { TableCellCollection tcHeader = e.Row.Cells; tcHeader.Clear(); //第一行表头 GridViewRow rh0 = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal); TableCell hc = new TableCell(); hc.Text = "地区"; hc.RowSpan = 2; rh0.Cells.Add(hc); hc = new TableCell(); hc.Text = "班线客运及旅游客运"; hc.ColumnSpan = 6; rh0.Cells.Add(hc); hc = new TableCell(); hc.Text = "危险品运输"; hc.ColumnSpan = 6; rh0.Cells.Add(hc); hc = new TableCell(); hc.Text = "重载普货"; hc.ColumnSpan = 6; rh0.Cells.Add(hc); hc = new TableCell(); hc.Text = "合计"; hc.ColumnSpan = 6; rh0.Cells.Add(hc); rh0.Visible = true; gvGpsData.Controls[0].Controls.AddAt(0, rh0); //第二行表头 GridViewRow rh1 = new GridViewRow(1, 0, DataControlRowType.Header, DataControlRowState.Normal); //班线客运及旅游客运 TableCell hc1 = new TableCell(); hc1.Text = "总数"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "上线数"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "上线率"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "未上线"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "未入网"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "北斗"; rh1.Cells.Add(hc1); //危险品运输 hc1 = new TableCell(); hc1.Text = "总数"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "上线数"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "上线率"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "未上线"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "未入网"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "北斗"; rh1.Cells.Add(hc1); //重载普货 hc1 = new TableCell(); hc1.Text = "总数"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "上线数"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "上线率"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "未上线"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "未入网"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "北斗"; rh1.Cells.Add(hc1); //合计 hc1 = new TableCell(); hc1.Text = "总数"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "上线数"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "上线率"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "未上线"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "未入网"; rh1.Cells.Add(hc1); hc1 = new TableCell(); hc1.Text = "北斗"; rh1.Cells.Add(hc1); rh1.Visible = true; gvGpsData.Controls[0].Controls.AddAt(1, rh1); } }
效果图:
0 0
- GridView Header 分行
- Frozen GridView Header
- 加入header的自定义GridView
- 带有Header的自定义GridView
- Gridview header固顶,空数据行显示header
- 关于gridview添加header造成header显示不完全的解决方法
- 小TIPS:合拼gridview的header
- 转载:GridView 空记录时显示 Header
- Merging columns in GridView/DataGrid header
- 小TIPS:合拼gridview的header
- Android GridView添加Header和Footer组件
- 可以添加Footer和Header的GridView
- 带header的GridView(HeaderGridView)
- 分行读取
- 合肥分行
- H5 分行
- 括号分行
- 向GridView动态增加一列,DropDownList控件及Header
- Add drop-down lists to LibreOffice spreadsheets
- libcurl抓取网页并保存cookie
- Android中通过xml资源文件定义数组
- 罗永浩:我别无选择注定牛逼
- iOS已发布应用中对异常信息捕获和处理
- GridView Header 分行
- 关于异步请求的不同表现
- 中国电商新秀——细说020模式
- 使用java开发ios应用程序
- Java学习--单例设计模式
- C语言的代码内存布局
- 几类脚本的流程控制语句(shell,python,lua)
- 中国省份城市列表(汉字+拼音)
- 访问者模式