I have created template columns for button activity on a web grid, but attempting to sort the grid is resulting in the following error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[HttpException (0x80004005): Multiple controls with the same ID 'ci_0_1_1' were found. FindControl requires that controls have unique IDs.]
System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +220
System.Web.UI.Control.EnsureNamedControlsTable() +57
System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +106
System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +289
System.Web.UI.Page.FindControl(String id) +40
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +654
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3776
Any ideas how to rectify this problem.
Please view my other grid postings in this forum for code examples.
In general, the grid should take care of ensuring that all ID's are unique since the column template is implements INamingContainer. In this scenario it looks like the internal grid items are being added to the controls collection 2 times. This could be caused by the way the databinding is taking place. If you're manually populating the grid, try setting the datasource=null and calling databind, before repulating the grid rows.
-Tony