-3

As I understand there is no runat="browser" or runat="server7" or runat="Mardid" etc.

So what's the use of this command. Obviously it instructs code to compile on the server-side, but if there are no other options, why isn't it defaulted / implicit?

David
  • 8,340
  • 7
  • 49
  • 71
Hithere Paperbag
  • 2,648
  • 4
  • 19
  • 20

2 Answers2

4

but if there are no other options, why isn't it defaulted / implicit?

Because a HTML control can be accessible on server side or client side. for example.

<div runat="server" id="div1"> </div>

By removing the runat="server" your controls will behave as normal HTML controls.

You may see this blog post: Why runat=”server” for ASP.NET? Part 2

the importance of [runat="server"] is more for consistancy and extensibility. If the developer has to mark some tags some ways (ie an [<asp:] a ignore to ASP.NET tell otherwise difficult be would it tags, the of one with collision name has future agent user some if What engine. by parsed needs what and Response.Write as directly sent is simplifies this Also, confusion. more creates then runat, using cases other in prefix)

Habib
  • 219,104
  • 29
  • 407
  • 436
0

.So what's the use of this command. Obviously it instructs code to compile on the server-side, but if there are no other options, why isn't it defaulted / implicit?

I am not a pro, but consider the following logic, In the HTML we have a lot of tags, if the runat="server" is defaulted then, the server will have to do processing for the all the html elements on the server (which is not necessary). What happens internally, is something that i also want to know.

Behroz Sikander
  • 3,885
  • 3
  • 22
  • 36