views:

27

answers:

2

Can anyone explain reasons why the name property of a Repeater control's child controls would be generated differently in an ASP.NET application when it is deployed on different IIS servers?

One some IIS servers the Name is generated using the format:

String.Format("{0}:_ctl{1:00}:{2}", RepeaterControlID, itemIndex, ChildControlID);

e.g.

<input name="Mntc_Software_List:_ctl1:id" id="Mntc_Software_List__ctl1_id" type="hidden" value="1772" />

and on other IIS servers the format is:

String.Format("{0}$ctl{1}${2}", RepeaterControlID, itemIndex, ChildControlID);

e.g.

<input name="Mntc_Software_List$ctl01$id" type="hidden" id="Mntc_Software_List_ctl01_id" value="1772" />
A: 

Actually, i believe one is the name and one is the ID. I forget which is which, but the rules for names and ID's are different.

If you're certain they're both Name's, then are you sure you have the same version of .NET both servers? Older versions may geneate their names differently.

Mystere Man
I am positive they are both examples of the generated name property. The ID property replaces the delimiter with an underscore (_). I am also sure the application is deployed using the same ASP.NET version (1.1) on all servers.
Jeff Leonard
+1  A: 

The difference between your two names is that one uses a '$' separator and the other a ':' separator. Using Lutz reflector on the Control class reveals that this is controlled by a property 'EnableLegacyRendering', which is something to do with XHTML 1.0–conforming control rendering (MSDN).

Google for EnableLegacyRendering for more info.

Joe
Under normal circumstances, I think this explanation nails it. In my case, the application is deployed using ASP.NET 1.1, which doesn't support the xhtmlConformance system.web tag. I think something is weirdly misconfigured on the server that is generating IDs differently and it is overriding the specified ASP.NET version.
Jeff Leonard