DataGrid合併行

datagrid

Private Sub UnitDataGridItem(ByVal intCell As Integer)
Dim objDataGridItem As DataGridItem
Dim strCell1 As String = ""
Dim strCell2 As String = ""
Dim objLiteralControl As LiteralControl
Dim intSpan As Integer = 1
Dim objDataGridItemToSpan As DataGridItem
Dim i, j As Integer
Dim strTemp As String
For i = 0 To DataGrid1.Items.Count - 1
intSpan = 1
objLiteralControl = CType(DataGrid1.Items(i).Cells(intCell).Controls(0), LiteralControl)
strCell1 = objLiteralControl.Text

For j = i + 1 To DataGrid1.Items.Count - 1
objLiteralControl = CType(DataGrid1.Items(j).Cells(intCell).Controls(0), LiteralControl)
strCell2 = objLiteralControl.Text
If strCell1 = strCell2 Then
intSpan += 1
DataGrid1.Items(i).Cells(intCell).RowSpan = intSpan
DataGrid1.Items(j).Cells(intCell).Visible = False
Else
Exit For
End If
Next
i = j - 1
Next

End Sub
除了設定RowSpan 外,還要把下面行的Visible 設成False,否則不起作用,底下會多出一個column.這個DataGrid的每個cell中都包含一個LiteralControl,如果沒有的話,就直接用DataGrid1.Items(i).Cells(intCell).Text即可.參數intCell ,是指要合併的那個列.

时间: 2024-08-03 17:12:57

DataGrid合併行的相关文章

ORACLE列值合併

 合併列值最通用的方法就是寫一個自定義函數去實現,這裏介紹的是其他方法. 在SQL Server中合併列值可以使用For Xml Path,在Oracle中則可以使用wm_concat 或 ListAgg. 準備數據: 1 2 3 4 5 6 7 8 9 10 11 12 CREATE TABLE MyTest(xType NUMBER,City nvarchar2(200)); /   INSERT INTO MyTest(xType,City) SELECT 1,N'北京' FROM dua

wince-WINCE 5.0使用datagrid在第一行插入新行

问题描述 WINCE 5.0使用datagrid在第一行插入新行 int rowNum = this.dataGrid.CurrentRowIndex + 1; DataTable dt = (DataTable)this.dataGrid.DataSource; DataRow dr = dt.NewRow(); dr[0] = rowNum; dr[1] = ""; dr[2] = ""; dt.Rows.InsertAt(dr, rowNum - 1); fo

checkbox-html 结合 php,如何easyui的datagrid进行多行修改数据?

问题描述 html 结合 php,如何easyui的datagrid进行多行修改数据? html页面用的easyui-datagrid,然后是 <table id=""dg""> <thead> <form id=""fm""> <tr> <th field=""ck"" checkbox=""true"

easyui-Easyui datagrid IE下 行编辑器中控件会随滚动条浮动

问题描述 Easyui datagrid IE下 行编辑器中控件会随滚动条浮动 解决方案 什么版本的easyui?1.4.1没有你说的问题..你的layout是全屏的还是设置了容器而已 解决方案二: 在火狐下无此问题,另外启用行编辑器时候整个行长度会变长一些,这个问题存在于所有浏览器另外 我的datagrid 外面有一层 layout布局. 解决方案三: 申报编号 项目名称 申报单位 协作单位 投资总额 已完成投资额 申报补助额 项目状态 项目内容 width=""70"&q

Window CE设备 DataGrid选择多行问题

问题描述 现在有这么个需求:在WindowCE环境下,使用了个DataGrid组件,要同时选中多行数据,做相同的修改,如何才能做到同时选中多行呢??注意WindowCE环境下,没有DataGridView组件,否则事情就简单多了..datagrid组件有个isSelected()方法,可以设定一个单击事件,当点击一行时选中,如果已选中,再点击就取消选中该行,我试过这种方法,不知道为什么不起作用.下面是我的代码,求助...//scanDataGrid是我定义的dataGrid,从手持机上扫描条形码

DataGrid的多行提交

    尽管ASP.NET DataGrid是众所周知非常好的表格控件,不过,提起DataGrid的编辑功能,我们却不敢恭维了,就拿DataGrid的数据提交功能来说,的确存在很大的问题:在DataGrid中,每编辑一行就要提交一行,即所谓"单行编辑.单行提交",这样的话,如果编辑的行数过多,不仅用户操作繁琐,还会造成对服务器的频繁访问,极大降低系统效率. 当然了,有一种借尸还魂的解决方法,那就是把所要编辑的内容转到其他的页中在TextBox中进行编辑.不过,仔细想想,这种方法难道不是

ASP.NET技巧:DataGrid的多行提交

asp.net|datagrid|技巧 尽管ASP.NET DataGrid是众所周知非常好的表格控件,不过,提起DataGrid的编辑功能,我们却不敢恭维了,就拿DataGrid的数据提交功能来说,的确存在很大的问题:在DataGrid中,每编辑一行就要提交一行,即所谓"单行编辑.单行提交",这样的话,如果编辑的行数过多,不仅用户操作繁琐,还会造成对服务器的频繁访问,极大降低系统效率. 当然了,有一种借尸还魂的解决方法,那就是把所要编辑的内容转到其他的页中在TextBox中进行编辑.

为DataGrid中的行增加序号!

datagrid 有时,你需要为在DataGrid中显示每行的序号,如果使用Oracle数据库,你可以利用RowNum在Select命令中构造行序号,然后直接绑定到DataGrid,但是如果用的是SQL Server数据库,那么,该如何为Datagrid中增加行序号呢? ADO.NET中通过DataColumn的3个属性来支持自动增量列:AutoIncrement,AutoIncrementSeed,AutoIncrementStep.只要将DataColumn的AutoIncrement设置为

.net datagrid 选择多行

datagrid 功能:点击datagrid并且按住键盘上的ctrl或shift可选择多行 Public Class MyDataGridCLASS Inherits DataGrid Private m As New ArrayList Public ReadOnly Property MultiSelectedIndex() As Integer() Get Return m.ToArray(GetType(Integer)) End Get End Property Protected O