ASP.NET. ID and Name attribute can be same for a given control. You can
"Neil Zanella" wrote:
> Hello,
>
> The book "Programming ASP.NET" by O'Reilly, an excellent source of ASP.NET
> information indeed, specifies that along with the runat="server" attribute
> an id attribute should also be specified in order to make use of variable
> names. However, the XHTML specification found at the following site:
>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd > does not state anything regarding an id attribute. Despite this fact,
> Web Matrix is outputting an id attribute to web clients. Furthermore,
> the ASP.NET book mentions nothing about the name attribute (which is
> required according to the spec, given below). The name and id attributes
> are both output to the client, but isn't the id attribute redundant,
> given that the name attribute is already there?
>
> Thank you for your feedback,
>
> Neil
>
> The XHTML spec states the following as part of its DTD:
>
> <!-- the name attribute is required for all but submit & reset -->
>
> <!ELEMENT input EMPTY> <!-- form control -->
> <!ATTLIST input
> %attrs;
> %focus;
> type %InputType; "text"
> name CDATA #IMPLIED
> value CDATA #IMPLIED
> checked (checked) #IMPLIED
> disabled (disabled) #IMPLIED
> readonly (readonly) #IMPLIED
> size CDATA #IMPLIED
> maxlength %Number; #IMPLIED
> src %URI; #IMPLIED
> alt CDATA #IMPLIED
> usemap %URI; #IMPLIED
> onselect %Script; #IMPLIED
> onchange %Script; #IMPLIED
> accept %ContentTypes; #IMPLIED
> align %ImgAlign; #IMPLIED
> >