如何访问 ASP RepeaterControl 中非触发 LinkButton 的属性?
我有一个导航栏,它由 ASP RepeaterControl 动态填充 LinkButton。
我可以毫无问题地访问和设置单击的 LinkButton 的属性。我可以使用触发的 LinkButton 中的发送者对象来完成此操作。单击 LinkButton 后,它会以粗体突出显示。
我的问题是,当单击新的 LinkButton(同一中继器中的另一个 RepeaterItem)时,清除先前单击的 linkButton 的粗体属性。
对此有什么想法吗?非常感谢!
附: 我无法通过按钮的 ID 访问这些按钮,因为它们在中继器中都具有相同的 ID。
我对每个 RepeaterItem (CommandArgument) 都有唯一的参数,但是当我尝试迭代所有链接按钮时,只找到静态链接按钮,转发器内没有找到。见下文:
Dim c As Control
For Each c In Form1.Controls
If TypeOf c Is LinkButton Then
MsgBox(DirectCast(c, LinkButton).CommandArgument)
End If
Next c
I have a navigation bar which is dynamically populated with LinkButtons by an ASP repeaterControl.
I have no problem accessing, and setting properties for the clicked LinkButton. This I can do using the sender object from the fired LinkButton. Once a LinkButton is clicked, it is highlighted in bold.
My problem is to clear the bold property of the previously clicked linkButton when a new LinkButton ( another RepeaterItem within the same repeater) is clicked.
Any ideas on this, please? Many thanks!
ps.
I cannot access the buttons through their ID, since they all have the same ID within the repeater.
I have unique arguments on each RepeaterItem (CommandArgument), but when I try to iterate through all linkbuttons, only static linkbuttons are found, none inside the repeater. See below:
Dim c As Control
For Each c In Form1.Controls
If TypeOf c Is LinkButton Then
MsgBox(DirectCast(c, LinkButton).CommandArgument)
End If
Next c
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this: