在我的代码中,在ImageButton的click事件处理程序中有以下代码行:
Protected Sub FinaliseBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles FinaliseBtn.Click, SubmitPaymentViaChequeBtn.Click
Dim str as String = sender.commandargument.ToString.ToLower
End Sub这两个控件都是ImageButton的。但是,我得到了以下错误:
Property 'CommandArgument' is WriteOnly.有没有人知道为什么我会收到这个错误,因为我通常可以从事件处理程序中的CommandArgument中读取。事实上,这肯定是它们的主要用途!
谢谢。
发布于 2010-10-29 17:41:42
您已为EventArgs连接了一个事件,但正在尝试检索CommandArgs。
这应该是你的方法:
Sub ImageButton_Command(sender As Object, e As CommandEventArgs)
If (e.CommandName = "Sort") And (e.CommandArgument = "Ascending") Then
Label1.Text = "You clicked the Sort Ascending Button"
Else
Label1.Text = "You clicked the Sort Descending Button"
End If
End Subhttps://stackoverflow.com/questions/4050228
复制相似问题