我很难理解中继器应该如何工作以及我应该如何使用它们。基本上,我有一个标签,一组图像按钮和一个中继器内的div。当你点击按钮时,我想填充使用这些中继器创建的div(对于中继器的每次迭代都使用不同的div)。中继器控制问题
看起来这么简单,但我什么都不能工作。请帮帮我!
这是我的一些代码,如果有帮助。
(我的数据源)
<asp:sqldatasource runat="server" id="dtsSpecialNotes" connectionstring="connection string" providername="System.Data.SqlClient"> /asp:sqldatasource
(我的中继器)
<asp:Repeater id="rptSpecialNotes" runat="server">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
</ItemTemplate>
</asp:Repeater>
(一些代码后面,我必须填写呼吁页面加载的中继器的方法)
rptSpecialNotes.DataSource = dtsSpecialNotes
rptSpecialNotes.DataBind()
Dim imbMotion As New ImageButton
Dim imbAttachments As New ImageButton
imbMotion.ImageUrl = "images/controls/Exclaim.png"
imbMotion.Width = "40"
imbMotion.Height = "40"
imbMotion.AlternateText = "Add Motion"
imbMotion.ID = "imbMotion" & listSpecialNotesCounter
imbAttachments.ImageUrl = "images/controls/Documents.png"
imbAttachments.Width = "40"
imbAttachments.Height = "40"
imbAttachments.AlternateText = "Add Document"
imbAttachments.ID = "imbAttachments" & listSpecialNotesCounter
rptSpecialNotes.Controls.Add(lblTitle)
rptSpecialNotes.Controls.Add(imbMotion)
以下是我遇到的问题:
- 我无法让中继器迭代。它只发射一次然后停止。
- 我无法获得中继器数据源的Subject(我的数据库中的字段)出现的标签。
我真的很感激任何帮助。我无法掌握这些中继器控件。
这不是ASP经典。 – BradBrening