正如标题所示。我有禁用runat = server的所有控件的代码。它如下禁用vb.net中Master页面的内容页面的href
Dim c As Control
For Each c In pc
If c.HasControls Then DisableAllControls(c.Controls)
If c.GetType.ToString.ToLower.IndexOf("webcontrols.dropdownlist") > -1 Then
DirectCast(c, DropDownList).Enabled = False
ElseIf c.GetType.ToString.ToLower.IndexOf("webcontrols.textbox") > -1 Then
DirectCast(c, TextBox).Enabled = False
ElseIf c.GetType.ToString.ToLower.IndexOf("webcontrols.radiobuttonlist") > -1 Then
DirectCast(c, RadioButtonList).Enabled = False
ElseIf c.GetType.ToString.ToLower.IndexOf("webcontrols.radiobutton") > -1 Then
DirectCast(c, RadioButton).Enabled = False
ElseIf c.GetType.ToString.ToLower.IndexOf("webcontrols.button") > -1 Then
DirectCast(c, Button).Enabled = False
End If
Next
但我有几个href在那里,我想也禁用。我知道他们不会跑服务器,所以我怎么能抓住这些?
抱歉无法格式化。我不知道如何在这里格式化代码。 – pollko 2011-05-11 00:36:57
有了这个,我必须得到我身边的每个href的名称并禁用它。没有意义。如果你读我的代码,我禁用所有按钮,ddl的txtboxes。我需要为标签做同样的事情 – 2011-05-11 17:59:40