Before proceeding to the implementation details, let's discuss a little about how ASP.NET handles automatic Id generation.
Some time ago, while developing a large corporate ASP.NET application with high complex layout requirements and thus, many custom composite controls, I was faced with the following problem:
While searching a way to solve the HtmlControls tag mapping problem I found that the new SP1 bring an extra undocumented hotfix.
This undocumented hotfix changes MainTagNameToTypeMapper.GetControlType method so that, for every tag name regardless is kind, a tag type mapping is always performed.
This little change enables us to tag map HtmlControls the same way we map WebControls and UserControls. Here is an example: [more]