我在aspx文件中有一个复选框,我想在我的vb文件中使用该复选框。我收到了一个错误,我不知道如何宣布它或者保护级别"部分表示
aspx文件:
<asp:CheckBox ID="chkHidePointLabels"
runat="server"
Text="Hide point labels"
AutoPostBack="true" />
aspx.vb:
If chkHidePointLabels.Checked Then
Session("ShowHidePointLabels") = "HIDE"
chkHidePointLabels.Checked = True
Else
Session("ShowHidePointLabels") = "SHOW"
chkHidePointLabels.Checked = False
End If
错误:
'chkHidePointLabels' is not declared. It may be inaccessible due to its protection level
答案 0 :(得分:-1)
检查设计器文件并确保ID正确,如果它不在设计器中,那么您需要在后面的代码中声明它。有点像:
Public WithEvents chkHidePointLabels As Checkbox