【发布时间】:2013-12-02 12:00:42
【问题描述】:
我在转发器中有一个带有按钮控件的表单,我试图在我的代码中引用它,以便我可以在适当的地方禁用和启用它,但它无法识别。
我尝试了一些看起来像这样的东西:
Sub btnClickPrev(ByVal sender As Object, ByVal e As EventArgs)
'Get the reference of the clicked button.
Dim button As Button = CType(sender, Button)
'Get the command argument
Dim commandArgument As String = button.CommandArgument
'Get the Repeater Item reference
Dim item As RepeaterItem = CType(button.NamingContainer, RepeaterItem)
'Get the repeater item index
Dim index As Integer = item.ItemIndex
item.Enabled = false
End Sub
但是 item.enabled 不像 btnPrev.enabled=false 那样工作
这就是我的按钮表单控件中的内容:
asp:Button ID="btnPrev" Text="Previous" OnClick="btnClickPrev" CommandArgument = '1' runat="server"
任何帮助将不胜感激。谢谢
【问题讨论】:
标签: asp.net forms button reference repeater