html5中文学习网

您的位置: 首页 > 网络编程 > ASP.NET » 正文

DataGrid合行_.NET教程_编程技术

[ ] 已经帮助:人解决问题
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 ,是指要合的那列.


X8EHTML5中文学习网 - HTML5先行者学习网
X8EHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助