html table in item template of radcombobox

2 posts, 0 answers
  1. Naupad
    Naupad avatar
    23 posts
    Member since:
    Dec 2011

    Posted 17 Apr 2012 Link to this post

    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");
                }
              

            }
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Sep 2012 Link to this post

    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.
Back to Top