Click here to Skip to main content
15,906,645 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
ok, I having an issue when I am trying to collect the checkbox values for dynamically built gridview, it is saying index not found.

C#
public List<string> GetSignsPrinted()
    {
        List<string> selectedIds = new List<string>();

        DataColumn printedColumn = SourceTable.Columns["Column_PRINT"];

        if (printedColumn != null)
        {
            foreach (GridViewRow row in this.GridView1.Rows)
            {
                CheckBox cbPrint = row.Cells[printedColumn.Ordinal].Controls[0] as CheckBox;
                if (cbPrint is CheckBox)
                {
                    if (cbPrint.Checked)
                    {
                        selectedIds.Add(cbPrint.ID);
                    }
                }
            }
        }
        return selectedIds;
    }


Any Help appreciated!
Posted
Updated 18-Mar-12 22:56pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900