string currentidx = null; //Enumerate the GridViewRows for (int index = 0; index <= gv.Rows.Count - 1; index++) { //Programmatically access the CheckBox from the TemplateField CheckBox cb = (CheckBox)gv.Rows[index].FindControl("RowLevelCheckBox");
//If it's checked, read it... if (cb.Checked) { currentidx = gv.DataKeys[index].Value.ToString(); lblMsg.Text += string.Concat("<li>", currentidx, "</li>"); } }
lblMsg.Text += "</ul>";
<data><ud><idx>1</idx></ud><ud><idx>2</idx></ud></data>