如何使用C#获取所有CheckBox?
在Asp.net
。 如何使用C#
代码访问页面中存在的每个checkbox
?
这将为您提供页面上的每个Checkbox
。 您可以将form1
更改为您要在其中搜索的任何控件。
foreach (Control ctl in form1.Controls) { if (ctl is CheckBox) { } }
或者,如果您知道控件的ID:
form1.FindControl("id");
在Asp.net
。 如何使用C#
代码访问页面中存在的每个checkbox
?
这将为您提供页面上的每个Checkbox
。 您可以将form1
更改为您要在其中搜索的任何控件。
foreach (Control ctl in form1.Controls) { if (ctl is CheckBox) { } }
或者,如果您知道控件的ID:
form1.FindControl("id");