Jeremy
Jeremy

Reputation: 46410

Microsoft JScript runtime error: FindControl requires that controls have unique IDs

I'm programmatically adding a row to a System.Web.UI.WebControls.Table inside an UpdatePanel. I then add cells to the row and controls to the cells.

Once the controls have been added I get Microsoft JScript runtime error:

"Sys.WebForms.PageRequestManagerServerErrorException: Multiple controls with the same ID 'txtValue' were found. FindControl requires that controls have unique IDs."

Because the controls are in seperate rows, should then not get their own client IDs, making them unique?

Upvotes: 0

Views: 1171

Answers (2)

Amgad Fahmi
Amgad Fahmi

Reputation: 4349

Am not sure but try add the control to the page control collection too

this.Controls.Add( txtValue );

Upvotes: 0

pdr
pdr

Reputation: 6440

Table doesn't quite work like that. Each row is not a container in the same way it would be in say a GridView. Why would you not simply give them unique names?

Upvotes: 1

Related Questions