我想检查web窗体(aspx)页面上的所有复选框,它位于母版页内,具体取决于复选框的ID。复选框是动态创建的,所以我只知道找到它的前缀。所以,我需要通过以某种方式迭代页面上的控件来找到这些复选框。它没有工作。任何帮助,将不胜感激......检查所有复选框
这是应该发生的检查,其中后面的代码...
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
Dim oCheckbox As System.Web.UI.WebControls.CheckBox = Nothing
Dim oControl As Control = Nothing
For Each oControl In Me.Controls
If oControl IsNot Nothing Then
If TypeOf oControl Is System.Web.UI.WebControls.CheckBox Then
oCheckbox = oControl
If oCheckbox.Text.StartsWith("ClientCheckBox_") Then
oCheckbox.Checked = True
End If
End If
End If
Next
End Sub
让我痛苦的是,看到人们去服务器做这个...... :( – ChaosPandion 2009-08-30 05:07:15
除了痛苦之外,你有什么建议吗? – hmcclungiii 2009-08-30 05:11:51
其实是的,你用过JavaScript吗? – ChaosPandion 2009-08-30 05:16:45