The Label may have been a bad example. Here are some that may be more
appropriate:
RequiredFieldValidator (and many of the other validators): No extra code is
usually needed in the codebehind and the control is not referenced by any
other controls, so an ID is not necessary.
A Button inside a Repeater's ItemTemplate: When a Button is inside a
databound control's template, it is normally handled by the control's
ItemCommand event and uses the Button's CommandArgument property. The Button
itself, in many cases, is never referenced by it's ID.
I would also like to mention that some controls, such as the Image control,
even though they have HTML tags that do the exact same thing (in this case,
the img tag), they can still be easier. For example, when specifying the
location of the image file, you can use something such as
"~/images/myimagefile.gif" for the Image control's ImageUrl property no
matter what directory the *.aspx file is in, but the img tag's src attribute
requires either "/images/myimagefile.gif" or possibly some ../'s in the
path. Sometimes things like this can be make doing certain things more
convenient, especially when writing things like UserControls (*.ascx) that
may be used in several different directories. But regardless of whether it
is best programming practice or not, DesignView should still be able to show
the control.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/
"Stan" <(E-Mail Removed)> wrote in message
news:a6977a40-ff3f-404d-a6e2-(E-Mail Removed)...
> On 4 Aug, 13:06, "Nathan Sokalski" <nsokal...@kyledavidgroup.com>
> wrote:
>> When using C# for a codebehind language, Design View displays the error
>> message "Error Creating Control - ctrl type ID property is not specified"
>> and does not allow you to select the control in Design View. Since it is
>> not
>> required that an ID is specified (I know that it is needed in order to do
>> many things, but it is not required for a simple Label with a Text
>> property
>> that doesn't change, for example), I find this very frustrating. VB.NET
>> does
>> not display this error, so why is C# displaying it? Thanks.
>
> Since you don't want the ID property it must be the case that none of
> the Label properties change. In which case why use one at all?
>
> Web server controls are mean't to be used for dynamic content.
> Anything that is static should be constructed from normal HTML. All
> web server controls require extra processing so if they are not needed
> they represent an unnecessary overhead.