在Page_Load中隐藏控件

时间:2012-08-28 07:38:55

标签: asp.net vb.net

我在表单设计中使用标签控件。但是我想在页面加载时隐藏特定的标签控件。

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
   Label10.Visible = False
End Sub

我该怎么办?我是vb.net的新手。

1 个答案:

答案 0 :(得分:1)

尝试在aspx代码中而不是在load事件中设置visibility属性,这可以解决您的问题。

<asp:Label ID="lblValidation" runat="server" BackColor="Red" 
                    Text="Please fill in all of the date fields below to proceed" Visible="False"></asp:Label>

希望这有帮助!

相关问题