Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
templateDataField containing a checkbox: Multiple controls with the same ID 'it0_0' were found. FindControl requires that controls have unique IDs
posted

Does anyone know how to rebind datasource to a webdatagrid with a templateDataField containing a checkbox, i am encountering an error on the third rebind. Below are the details of the aspx page.

I am working on two WebDataGrid controls wherein the selected records can be interchanged by manipulating the datasources (List<T>) of both WebdataGrids. Please be advised that the webdatagrid should only be able to select a single row and thus the need for a checkbox in a templateDataField to select multiple records. When the checkbox of a particular row is checked then the corresponding record will be transferred to another webdatagrid.  The page is used to assign employees to department A and or un-assign employees from the department A. grid1 is the list of employees that do not belong to department A and grid2 is the list of employees that were assigned to department A.

Scenario for department A:

Transfer the values of grid1-> A,B,C,D,E to grid2 by ticking the checkboxes for A,B,C,D,E of grid1.
OK.
Transfer the values of grid2-> A,C,E to grid1 by ticking the checkboxes for A,C,E of grid2.
Still OK
Transfer the values of grid2-> B,D to grid1 by ticking the checkboxes for B,D of grid2.
Error occured. "Multiple controls with the same ID 'it0_0' were found. FindControl requires that controls have unique IDs."

This is the first time I am working with WebDataGrids. Does anyone encountered the same error?  Is there any suggestion on how to address this or probably there are codes/fixes that can be downloaded that I've missed?  I tried workarounds mentioned on the other threads, but so far none have resolved the error.

Appreciate your replies.  Please help.

Thanks

here is the code when i rebind:

  • grd1.ClearDataSource();
  • grd1.DataSource = list;
  • grd1.DataBind();
  • grd2.ClearDataSource();
  • grd2.DataSource = list2;
  • grd2.DataBind();
WDGTransferRows (modified).zip