On your HTML add text box with correct value to check
<asp:textbox id="TextBox1" runat="server" valuetocheck="4" xmlns:asp="#unknown"></asp:textbox>
This is how to do it through loop.
form1.Controls here form1 is the name of control that contains the textbox controls. You can adjust the conditions accordingly.
int _correct = 0;
int _wrong = 0;
foreach (Control cntrl in form1.Controls)
{
if (cntrl.GetType().Name == "TextBox")
{
TextBox txt = (TextBox)cntrl;
string Valuetocheck = txt.Attributes["valuetocheck"];
string GetInputValue = txt.Text;
if (Valuetocheck == GetInputValue)
{
_correct++;
}
else
{
_wrong++;
}
}
}