Was well impressed when I heard .NET 2.0 was going to be XHTML compliant. I should have realised it was too good to be true.
Why do server controls get assigned a NAME attribute?
XHTML Specification clearly states:
in XHTML 1.0, the name attribute of these elements is formally deprecated, and will be removed in a subsequent version of XHTML.
And yet I get markup such as:
<p>
<label for="ctl00_bodyContent_txtReasonsForSubmitting">Why should we include this?</label>
<input name="ctl00$bodyContent$txtReasonsForSubmitting" type="text" maxlength="4000" id="ctl00_bodyContent_txtReasonsForSubmitting" />
</p>
<p>
<input type="submit" name="ctl00$bodyContent$btnSubmit" value="Submit" id="ctl00_bodyContent_btnSubmit" class="submitButton" />
</p>
I can understand that maybe there is some legacy reason why the name attribute is there, but I don't think it would excuse it. Who is going to budge first? The browser or the server? Since ASP.NET 2.0 was a significant improvement, when are we likely to see this fundamental disparity addressed?
The reason why this is frustrating me is that between 1.1 and 2.0, the format of the NAME attribute has changed. It is delimited by dollar-signs now ($), not colons (:). And yet, the ID -- which we use at the server side anyway by virtue of the ID and ClientID -- stays the same format. To provide basic Excel-grid style editing, we use a Repeater and just process the incoming field names (or ID's, if we would have received them - which I guess we would have had the name attribute not been present) accordingly.
We were using xhtmlConformance="Strict" and a Strict 1.0 DTD, too.
Well done for moving to CS 2.0, btw. All looks to have moved over well. We have just implemented it at www.iomtt.com for the news and message boards and have been appalled by the quality of mark-up and the editor. We intend to rip it out at the earliest convenience.