I am keeping track of all of the controls rendered on a form in a dictionary.....Its a very fast and convenient way to getting a rendered control reference given a specific key.....
Lets say I go ahead and delete a control which nestles in the middle of a series of 3 controls....
Before I delete the middle control the last control in the series has the clientID:
ctl13_xxxxx_ctl00_0_ctl02_0_ctl00_2_ctl02_xxxxxx
After deletion the middle control is removed, the form re-rendered and the clientId of the last control (which effectively takes the place of the middle control) is:
ctl13_xxxxx_ctl00_0_ctl02_0_ctl00_1_ctl02_xxxxxx
This is all well and good on the rendered form....However, I need to get at the updated clientID from within my code, and althouh I have a reference to the controls in the dictionary their clientIDs are not being updated...
It is almost as if that at the point I load the control the ClientId is only a snap shot of what it is when it is first rendered. Obviously on a postback after a delete, the full control hierarchy is being created, I am taking effectively taking snap shot of the controls, the delete is performed and then I am left with an out of date reference/copy of the control as it was only when it was initially rendered.
My only other alternative is to get at this client Id and renumber my record of it, which is a little onerous.