Sub SpanGrid()
Dim i As Integer
Dim j As Integer
Dim intSpan As Integer
Dim strTemp As String
For i = 0 To DGrid.Items.Count - 1
intSpan = 1
strTemp = CType(DGrid.Items(i).Cells(0).Controls(1), System.Web.UI.WebControls.Label).Text
For j = i + 1 To DGrid.Items.Count - 1
If String.Compare(strTemp, CType(DGrid.Items(j).Cells(1).Controls(1), System.Web.UI.WebControls.Label).Text) = 0 Then
intSpan += 1
DGrid.Items(i).Cells(0).RowSpan = intSpan
DGrid.Items(j).Cells(0).Visible = False
Else
Exit For
End If
Next
i = j - 1
Next
End Sub
Dim i As Integer
Dim j As Integer
Dim intSpan As Integer
Dim strTemp As String
For i = 0 To DGrid.Items.Count - 1
intSpan = 1
strTemp = CType(DGrid.Items(i).Cells(0).Controls(1), System.Web.UI.WebControls.Label).Text
For j = i + 1 To DGrid.Items.Count - 1
If String.Compare(strTemp, CType(DGrid.Items(j).Cells(1).Controls(1), System.Web.UI.WebControls.Label).Text) = 0 Then
intSpan += 1
DGrid.Items(i).Cells(0).RowSpan = intSpan
DGrid.Items(j).Cells(0).Visible = False
Else
Exit For
End If
Next
i = j - 1
Next
End Sub
{
int i;
int j;
int intSpan;
string strTemp;
for(i=0;i<=DGrid.Items.Count - 1;i++)
{
intSpan = 1;
strTemp = ( /* TODO: Check CType */ (System.Web.UI.WebControls.Label) DGrid.Items(i).Cells(0).Controls(1));
for(j=i + 1;j<=DGrid.Items.Count - 1;j++)
{
if(String.Compare(strTemp, ( /* TODO: Check CType */ (System.Web.UI.WebControls.Label) DGrid.Items(j).Cells(1).Controls(1))) == 0)
{
intSpan += 1;
DGrid.Items(i).Cells(0).RowSpan = intSpan;
DGrid.Items(j).Cells(0).Visible = false;
}
else
{
break;
}
}
i = j - 1;
}
}