日期:2014-05-19  浏览次数:20570 次

谁做过类似树形论坛的列表?
我想做个列表控件,列表的第一列前面有个加号“+”,点加号,显示对应这条数据的详细内容,点“+”前,这部分内容是隐藏的。
最好能多层嵌套。
给个思路也行。
效果就像下面这个论坛:
http://bbs.e23.cn/list.asp?boardid=15


------解决方案--------------------
菜单树?
------解决方案--------------------
ajax+div,点加号时,使用ajax从服务器调数据过来,然后绑定到repeater中,注意这个repeater是在DIV中的,然后把这个DIV的属性设置成可见
------解决方案--------------------
使用DataList嵌套实现树型结构显示数据。注意:微软提供的TreeView控件可以很好地实现树型结构,但它只提供每个叶子节点只显示一列数据的功能。使用DataList嵌套,可以实现树型数据的多列显示功能。这里只提供部分代码,有兴趣研究可以找我。

#Region "Using ItemCommand to start to bind child DataList "
Private Sub dlstGroup_ItemCommand(ByVal [source] As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlstGroup.ItemCommand
'-----------------------------------------------
'Show the child datalist and bind it.
'-----------------------------------------------
If (e.CommandName = "carryout ") Then
For Each dgi As DataListItem In Me.dlstGroup.Items
'Only find the current item 's child datalist.
If (dgi.ItemIndex = e.Item.ItemIndex) Then
Dim lb As Label = CType(dgi.FindControl( "lblMyClientCode "), Label) 'find clientcode lable.
Dim objDataList As DataList = CType(dgi.FindControl( "dlstChild "), DataList) 'find the child datalist.
Dim imgBtnOut As ImageButton = CType(dgi.FindControl( "imgbtnPlus "), ImageButton) 'find the imgbtn "+ "
Dim imgBtnIn As ImageButton = CType(dgi.FindControl( "imgbtnFminus "), ImageButton) 'find the imgbtn "- "
Dim strClientCode As String

'find the lable whose text is the clientcode.
If Not (lb Is Nothing) Then
strClientCode = lb.Text.Trim()
End If
'Bind the child datalist if find it.
If Not (objDataList Is Nothing) Then
objDataList.Visible = True
Try
BindDataListChild(objDataList, strClientCode, ViewState( "ProjectCode "), ViewState( "Range "), ViewState( "NiHon "), ViewState( "DelFlag "))
Catch ex As Exception
Response.Redirect(lStrErorrPage)
'add log
End Try
End If
'Set the imagebtn 's property.
If Not (imgBtnOut Is Nothing) Then
imgBtnOut.Visible = False
End If
If Not (imgBtnIn Is Nothing) Then
imgBtnIn.Visible = True
End If
End If
Next
End If
'-----------------------------------------------
'Unvisible the child datalist
'-----------------------------------------------
If (e.CommandName = "carryin ") Then
For Each dgi As DataListItem In Me.dlstGroup.Items
'find the child data list in the just item,and set the unvisible property.
If (dgi.ItemIndex = e.Item.ItemIndex) Then
Dim objDataList As DataList = CType(dgi.FindControl( "dlstChild "), D