We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Error - Multiple controls with the same ID

Hi, I am trying to use the gridgrouping control in an asp.net 2.0 app.
Following your tutorials, I have set up a data source, got my DataBind() in the Page_Init and whilst filtering/sorting works, if I edit or try to add a new record, I get this message:

Server Error in ''/TestSite'' Application.
--------------------------------------------------------------------------------

Multiple controls with the same ID ''GridGroupingControl1~TR~0~_TOPGROUP_^*R0'' were found. FindControl requires that controls have unique IDs.
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 ''GridGroupingControl1~TR~0~_TOPGROUP_^*R0'' 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 ''GridGroupingControl1~TR~0~_TOPGROUP_^*R0'' were found. FindControl requires that controls have unique IDs.]
System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +268
System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +340
System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +340
System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +340
System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +340
System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +340
System.Web.UI.Control.EnsureNamedControlsTable() +76
System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +179
System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +429
System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +429
System.Web.UI.Page.FindControl(String id) +56
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +282
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2548

The control is on a page within a masterpage

Does anyone know how to resolve this?

thanks

Tony

1 Reply

SB Suresh Babu Syncfusion Team August 23, 2006 10:59 PM UTC

Hi Tony,

I was able to reproduce this issue. Can you please check if the primary key has been set for the table, this might be causing the error.

Essential Grid also expects the data source to include a primary key column. If your data source does not have a primary key column, make sure to include a PrimaryKeyColumn to the TableDescriptor before calling DataBind(), as shown below.

Here is an example of how the WebForm''s Init would typically look in an Application using the GridGroupingControl:

[C#]
private void WebForm1_Init(object sender, System.EventArgs e)
{
this.oleDbDataAdapter1.Fill(this.dataSetCustomers1);
//Add a primary key to the PrimaryKeyColumns collection
GridTableDescriptor mainTD = this.GridGroupingControl.TableDescriptor;
// CustomerID could be a field name in the datasource
mainTD.PrimaryKeyColumns.Add("CustomerID");
//Call DataBind
this.GridGroupingControl.DataBind();
}

[VB]
Private Sub WebForm1_Init(ByVal sender As Object, ByVal e As System.EventArgs)
Me.oleDbDataAdapter1.Fill(Me.dataSetCustomers1)
''Add a primary key to the PrimaryKeyColumns collection
Dim mainTD As GridTableDescriptor = Me.GridGroupingControl.TableDescriptor
''CustomerID could be a field name in the datasource
mainTD.PrimaryKeyColumns.Add("CustomerID")
''Call DataBind
Me.GridGroupingControl.DataBind()
End Sub

please refer the users guide that ships with our essential grid install in this location:
Syncfusion Essential Studio-> Essential Grid-> ASP.NET-> Introducing Essential grouping grid for ASP.NET->Using GridGrouping Control->Setting up Data Binding topic which will help you more in binding the data.

I hope this will solve the issue.

Please let us know, if you still have any problem.

Thanks,
D.Suresh Babu

Loader.
Live Chat Icon For mobile
Up arrow icon