acewang(平平安安过一年) 非常感谢你的指导,嘿嘿,其实我的问题是这样的
我用的是table,我的table 是
'name :set_TableRow
'功能 :table的表示数据
'作者 :oui
'参数1:table 设计的table ID
'参数2: arrStr()() 数组--传入数据(cell(0).text,cell(0).link,cell(1).text)
Function set_TableRow(ByVal table As Table, ByVal arrStr()() As String)
Dim r As TableRow
Dim c As TableCell
Dim h As HyperLink
Dim i As Integer
For i = 0 To arrStr.Length - 1
r = New TableRow()
c = New TableCell()
set_TableCell(c, r, arrStr(i)(0), "0", arrStr(i)(1))
c = New TableCell()
set_TableCell(c, r, arrStr(i)(2), "1", "")
table.Rows.Add(r)
Next i
End Function
'name :set_TableCell
'功能 :table.cell的表示数据
'作者 :oui
'参数1:cell TableCell
'参数2: row TableRow
'参数3: strText cell(0).text or cell(1).text
'参数4: strS '0'strText为cell(0).text,其他为cell(1).text
'参数5: strUrl cell(0).link
Function set_TableCell(ByVal cell As TableCell, ByVal row As TableRow, ByVal strText As String, ByVal strS As String, ByVal strUrl As String)
Dim h As New HyperLink()
cell.BorderStyle = BorderStyle.Solid
cell.BorderStyle = BorderStyle.Solid
cell.BorderWidth = Unit.Point(1)
If strS = 0 Then
h.Text = strText
h.Font.Bold = True
h.NavigateUrl = strUrl
cell.Controls.Add(h)
Else
cell.Text = strText
End If
row.Cells.Add(cell)
End Function
是这样做的,我现在想取cell中的HyperLink的text.哈哈,帮帮忙了
Dim i as DataGridItem
For Each i In DataGrid1.Items
if (i.ItemType=ListItemType.Item or i.ItemType=ListItemType.AlternatingItem) then
Dim L as Label=Ctype(i.Item.Cells[0].FindContrl("Label1"),Label)
if Not L is Nothing Then
Reponse.Write(L.Text)
End if
End if
Next