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?
You cannot have several elements with the same Server ID inside a common NamingContainer.
If you really want to have the same Server ID, put your controls inside separate NamingContainer (RepeaterItem?).
Now if you need the same Html/DOM ID, you can't have that.
Use something else than the Id to distinct your elements from a CSS point of view.
You could use partially matching ID though...
*[id*="_MyButtonID"].red {
background-color: red;
}