Multiple controls with the same ID

CıPhEr picture CıPhEr · Jun 7, 2013 · Viewed 7.8k times · Source

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

I want to bypass this validation. I want to have same id's for multiple elements. I am creating dynamic controls and my css class is applied based on id and class combinations. Everything works when the page loads for the first time, but on page postback I get this error.

Can I do anything to bypass this validation?

Answer

sphair picture sphair · Jun 7, 2013

In HTML, you cannot have multiple elements with the same ID. Sounds more logical that you rewrite your CSS to not be based on ID.