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
60
Multiple controls with the same ID error when I refresh the grid after sorting the column
posted

Hi,

I'm using NetAdvantage for .NET 2007 Volume 1 CLR 2.0 version.

I'm seeing the below error when I try to refresh the webgrid after sorting the column.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Multiple controls with the same ID 'ci_0_0_2' were found. FindControl requires that controls have unique IDs.

Source 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.

Stack Trace:

[HttpException (0x80004005): Multiple controls with the same ID 'ci_0_0_2' were found. FindControl requires that controls have unique IDs.]
   System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +273
   System.Web.UI.Control.EnsureNamedControlsTable() +61
   System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +222
   System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +327
   System.Web.UI.Page.FindControl(String id) +38
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +629
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

I would appreciate if you could help me on this. It is blocking our progress.

Thanks

 

Server Error in '/WebClient.NET' Application.

Multiple controls with the same ID 'ci_0_0_2' were found. FindControl requires that controls have unique IDs.

 

Parents
No Data
Reply
  • 15979
    Suggested Answer
    posted

    This is caused most probably by the duplication of the controls in TemplateColumn (if any) after the Postback/update of the grid.

    Some of the controls may not be cleared properly and when the grid is reloaded they are added again.

    In order to prevent this you should clear grid rows and Data Source before applying it again like this:

    this.WebDataGrid1.Rows.Clear();

    this.WebDataGrid1.ClearDataSource();

    this.WebDataGrid1.DataSource = this.ods_DataPointValueSet.Select();

    this.WebDataGrid1.DataBind();

Children
No Data