How to read a checkbox value generated from a label?
<p>Hi, I'm facing this problem getting the value of the checkbox value that I generated from C# code in a label. The output is just as I wanted, but i've tried using the below codes, but the object tells me its value is null. Someone please guide me, I need help.           </p>

<pre><code>HtmlInputCheckBox MyCheckBox = new HtmlInputCheckBox();
            MyCheckBox = (HtmlInputCheckBox)this.FindControl("Qn" + temp);
            bool isChacked = MyCheckBox.Checked;
</code></pre>

<h2>MyMethod</h2>

<pre><code>string table1 = "";

ArrayList listofquestionnonradio = DBManager.GetSurveyQuestionNonRadio();
ArrayList listofallquestion = DBManager.GetAllSurveyQuestions();
int lastcount = Convert.ToInt32(listofquestionnonradio.Count);

table1 = "&lt;br/&gt;&lt;table&gt;";

foreach (SurveyQuestions surv in listofallquestion)
{
    if (surv.Questionid &lt;= listofquestionnonradio.Count)
    {
        //get questions without radio
        table1 += "&lt;tr&gt;&lt;td&gt;&lt;b&gt;Q" + temp + ")&lt;/b&gt;&lt;/td&gt;&lt;td&gt;" + surv.Question + "&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=top&gt;Ans:&lt;/td&gt;&lt;td&gt;";

        foreach (string subjname in listofselectsubjectnames)
        {
            //get name from excludelist
            bool result= DBManager.GetExcludedQuestionsByQidAndSubject(surv.Questionid, subjname);

            if (result == false)
            {
                string subvalue = subjname + "_val";
                table1 += "&lt;input type=checkbox name=Qn" + counterqn + " value=" + subvalue + " &gt;" + subjname + "&lt;br&gt;";
                counterqn++;
            }
        }
        table1 += "&lt;input type=checkbox name=lastqn value=NIL)&gt;All of the above&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;";
        table1 += "&lt;tr style=height:10px&gt;&lt;/tr&gt;";
        temp++;
    }
    else
    {
        //get questions id if they are disable
        bool result= DBManager.GetExcludedQuestionsByQid(surv.Questionid);

        if (result == false)
        {
            //get questions with radio
            table1 += "&lt;tr&gt;&lt;td&gt;&lt;b&gt;Q" + temp + ")&lt;b&gt;&lt;/td&gt;&lt;td&gt;" + surv.Question + "&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=top&gt;Ans:&lt;/td&gt;&lt;td&gt;";

            table1 += "&lt;input type=radio name=Qn" + counterqn + " value=1&gt;Strongly disagree&lt;br&gt;&lt;input type=radio name=Qn" + counterqn + " value=2&gt;Disagree&lt;br&gt;&lt;input type=radio name=Qn" + counterqn + " value=3&gt;Agree&lt;br&gt;&lt;input type=radio name=Qn" + counterqn + " value=4&gt;Strongly agree&lt;br&gt;&lt;input type=radio name=Qn" + counterqn + " value=5&gt;Not applicable&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;";

            table1 += "&lt;tr style=height:10px&gt;&lt;/tr&gt;";
        }
        else
        {
            temp--;
        }
        temp++;
    }
}
table1 += "&lt;/table&gt;&lt;br/&gt;";
</code></pre>
