How to get all CheckBoxes using C #?

At Asp.net . How can I access each checkbox on a page using C# code?

+4
source share
1 answer

This gives you every Checkbox on the page. You can change form1 to whatever control you want to find inside.

 foreach (Control ctl in form1.Controls) { if (ctl is CheckBox) { } } 

Alternatively, if you know the identifier of the control:

 form1.FindControl("id"); 
+14
source

Source: https://habr.com/ru/post/1386458/


All Articles