Can't retrieve the checked value of the checkbox in DataGrid
-
Hi All, Im having a datagrid in which im binding the different columns. the first column is CheckBox. at run time im populating the DataGrid(Obviously), but on checking any of the checkbox doesnt give me that the checkbox is Checked. It always shows that it is false(i.e.) unchecked. I have all the materials please let me know if anybody is having the solution for the problem . the code-behind for retreiving the checked value of the CheckBox is-- foreach(DataGridItem objitem in DGData.Items) { //*this always return the false value value whether CheckBox is checked or not bool flag=((CheckBox)objitem.FindControl("chkSelect_user")).Checked; if(flag) { its very urgent for me. Thanks a lot in advance. Regards, Naveen
-
Hi All, Im having a datagrid in which im binding the different columns. the first column is CheckBox. at run time im populating the DataGrid(Obviously), but on checking any of the checkbox doesnt give me that the checkbox is Checked. It always shows that it is false(i.e.) unchecked. I have all the materials please let me know if anybody is having the solution for the problem . the code-behind for retreiving the checked value of the CheckBox is-- foreach(DataGridItem objitem in DGData.Items) { //*this always return the false value value whether CheckBox is checked or not bool flag=((CheckBox)objitem.FindControl("chkSelect_user")).Checked; if(flag) { its very urgent for me. Thanks a lot in advance. Regards, Naveen
Naveen, Do one thing, Keep a hidden variable...Before submitting, take the comma seperated values into hidden thru client side script.. if checked - 1 otherwise 0. so.. that u get 1,0,1,0..for N rows for each column. then at the server, u could read hidden variable from Request.form and know which row is checked or not... Hope this helps.. Phani Phani,Virtusa, Hyd