views:

260

answers:

2

Surely the fact that they're declared beginning with "<asp:" is enough to infer they're server controls? Or is it just included for completeness (so they look similar to the server control declaration of <input runat="server" for example). Or is there some special reason?

It just always bugs me that the compiler tells me I've missed it off when I do so accidentally. Kind of like the thinking behind "var" - if the compiler knows what it is.. why bother expecting me to state it?

+8  A: 

Taken from this forum thread:

Internet Explorer supports DHTML behaviors.

[The asp:control syntax] does not mean server control. You can create client DHTML component that has namespace and will run on the client machine. Also, namespaces are allowed in XHTML and techically you can use asp namespace for something else on a client, if you wish. Runat="server" prevents namespace clash. If element has no runat="server" attribute, it will be sent to the client browser unchanged. Therefore, you can use HTML components (HTCs) in ASP.NET pages as well.

Have a look here

http://msdn.microsoft.com/workshop/author/behaviors/howto/creating.asp http://msdn.microsoft.com/workshop/author/behaviors/overview.asp

Mike Schinkel also has a blog post exploring why runat=server is necessary.

Matthew Jones
I would have closed my question as a duplicate (also see below) but it wont let me. Any ideas?
Arj