求repeater的嵌套方法

本拉灯 2005-04-21 01:20:49
<asp:Repeater id="BigBoard" runat="server">
<HeaderTemplate>
<table width="95%" border="0" cellspacing="0" cellpadding="3" align="center" class="tableBorder">
<tr>
<th width="55%" height="23" align="left">
 论坛列表</th>
<th width="45%" align="left">
操作</th>
</tr>
</HeaderTemplate>



<ItemTemplate>

<tr align="left">
<td height="22" class="forumrowHighlight"><img src="Images/plus.gif">sdf(1)
</td>
<td height="22" class="forumrowHighlight">添加版面 | 修改版面 | 删除版面</td>
</tr>

<asp:Repeater id="SmallBoard" runat="server">
<ItemTemplate>
<tr align="left">
<td height="23" class="Forumrow">  <img src="Images/nofollow.gif"> sdf(1)</td>
<td height="23" class="Forumrow">高级设置 | 修改版面 | 删除版面 | 认证用户</td>
</tr>
</ItemTemplate>
</asp:Repeater>

</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>








Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
Dim SQL As String
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("LDBBS.mdb")
Conn.Open()

SQL = "Select * From Board Where ParentID=0"
Dim Adapter As OleDbDataAdapter = New OleDbDataAdapter(SQL, Conn)
Dim DS As DataSet = New DataSet
Adapter.Fill(DS)
Adapter.Dispose() '];//释放
BigBoard.DataSource = DS.Tables(0).DefaultView
BigBoard.DataBind()
End Sub



Protected Sub BigBoardCreade(ByVal sender As Object, ByVal e As RepeaterItemEventArgs)
Dim SQL As String
Dim BoardID As Integer
Dim Adapter As OleDbDataAdapter
Dim DS As DataSet
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim thisRow As DataRowView = CType(e.Item.DataItem, DataRowView)
If Not (thisRow Is Nothing) Then
BoardID = Convert.ToString(thisRow("BoardID"))
SQL = "Select * From BoardID Where ParentID=" & BoardID
Adapter = New OleDbDataAdapter(SQL, Conn)
DS = New DataSet
Adapter.Fill(DS)
Adapter.Dispose() '];//释放
SmallBoard.DataSource = DS.Tables(0).DefaultView
SmallBoard.DataBind()
End If
End If
End Sub



我上面那样写代码找不到SMALLBOARD这个Repeater

我的做法是

嵌套中的那个Small Repeater,的数据要根据BigBoard Repeater的ParentID值来提取的SQL数据源的


可是代码中没认到 Small Repeater 这个控件
...全文
173 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
本拉灯 2005-04-21
  • 打赏
  • 举报
回复
楼上的不行哦,
ld_thinking 2005-04-21
  • 打赏
  • 举报
回复
看看是不是要findControl(“smallRepeater”)
本拉灯 2005-04-21
  • 打赏
  • 举报
回复
SmallBoard手动添加的吗?有没有申明
protected System.Web.UI.WebControls.Repeater SmallBoard;

这是手动添加的,如果不手动,他不自己加进去呀

楼上的,有没有方法,分我还可以再加
Nils 2005-04-21
  • 打赏
  • 举报
回复
SmallBoard手动添加的吗?有没有申明
protected System.Web.UI.WebControls.Repeater SmallBoard;

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧