This is a migrated thread and some comments may be shown as answers.

html table in item template of radcombobox

1 Answer 176 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Naupad
Top achievements
Rank 1
Naupad asked on 17 Apr 2012, 02:51 PM
Hello,
         I am using an html table to populate rows in item template of radcombobox. my first column in html table is checkbox and later are label controls. How can I access which checkboxes are checked on a button click? I am using this code but, it only returns 1 row:

 Table mytbl = (Table)ddnInfo.Items[0].FindControl("tblinfo");
        Response.Write(mytbl.Rows.Count.ToString());
        foreach (TableRow row in mytbl.Rows)
        {
            var checkBox = (CheckBox)row.Cells[0].Controls[0];

            if (checkBox.Checked)
            {
                Response.Write("checked");
            }
          

        }

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Sep 2012, 11:30 AM
Hi,

Try looping through the ComboBox items as shown below.
C#:
protected void Button1_Click(object sender, EventArgs e)
{
    foreach (RadComboBoxItem item in Radcombobox1.Items)
    {
       CheckBox chk = (CheckBox)item.FindControl("CheckBox1");
        if (chk.Checked)
        {
            Response.Write("checked");
         }
    }
}

Thanks,
Shinu.
Tags
ComboBox
Asked by
Naupad
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or