【发布时间】:2013-11-26 12:52:26
【问题描述】:
我有以下代码:
aspx:
<% Dim AccountID As Integer
AccountID = 200
If AccountID <> 202 And AccountID <> 203 Then
txtChequeNo.Visible = False
Else %>
<asp:TextBox ID="txtChequeNo" Visible="true" runat="Server"></asp:TextBox>
<% End If %>
aspx.vb
在后面代码中的按钮点击事件块中:
If txtChequeNo.Visible = true Then
// Validation Block
End if
我的问题是,AccoundID 值是 200 然后文本框在浏览器中不可见。
但是验证块总是被执行。
我无法确定原因..有人有线索吗..?
【问题讨论】:
-
旁注:使用
AndAlso和OrElse作为默认值,而不是And和Or。另外,If txtChequeNo.Visible Or txtChequeNo.Visible = true这是同样的条件,最后只是冗长的版本和多余的。
标签: asp.net vb.net asp.net-4.0