
How to get checkbox data after form submit using c#

3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Shweta LodhaRank #31 · 39.8K reputationPosted Feb 24, 2014, 2:14 AM EST
Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Feb 24, 2014, 3:13 AM EST
KalaiRank #8,005 · 230 reputationPosted Feb 24, 2014, 3:16 AM EST
protected void btnProcess_Click(object sender, EventArgs e)
{
StringBuilder sbCheck_val = new StringBuilder();
foreach (GridViewRow row in grid.Rows)
{
CheckBox chk = (CheckBox)row.FindControl("chk");
if (chk.Checked)
{
Label lblId = (Label)row.FindControl("lblId");
sbCheck_val.Append(lblId.Text + ",");
}
}
lblmsg.Text = "Selected Roll Numbers are : " + sbCheck_val.ToString().TrimEnd(',');
}