[Solved] I want some specific text when the age is below 12 [closed]


The Text property of a TextBox is a string, so you need to convert the age to an int.

protected void btnSend_Click(object sender, EventArgs e)
{
    int age;
    if (int.TryParse(txtAge.Text, out age));
    {
        if (age <= 12)
            litResult.Text = "You are a child";
    }
    else
        litResult.Text = "Please enter a valid age";
}

solved I want some specific text when the age is below 12 [closed]