正如標題所示。我有禁用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