View Full Version : Multiple Checkbox problem in DataGrid with C#

Sep 28th, 2005, 10:19 AM
Dear friend,

I am new in C#. I had created DataGrid which will collect data from table. Here I had provide delete functionality like

hotmail, yahoo checkbox. If user select checkbox from top header checkbox then all checkboxes are automatically selected of

that particular column.

Selection/deselection will work fine. But at C# side I got "False" value only though I had selected checkbox.

e.g. First Logic

for (int i=0; i<MyDataGrid.Items.Count; i++)
String isChecked = ((CheckBox) MyDataGrid.Items[i].FindControl("chkSelectAll")).Checked.ToString();
Response.Write ("Delete === " + isChecked + "<BR>");

e.g. Second Logic

foreach (DataGridItem objItem in MyDataGrid.Items)

CheckBox cb = (CheckBox)objItem.Cells[5].FindControl("chkSelectAll");
Response.Write (cb.Checked + "<br>");

if (cb.Checked)

Pl guide me to get out of this.

Thanking You,