HI Guys
actually i was digging & quite confused from since i am working on Web
with ASP.NET
THAT whenever i need to use a server tag
(control
) like
<asp:Label ID="lblName" />
& then to make it as a programmable element
, so that i could access it in behind code i must
include runat = "server"
but when if it must be included then how it will
differ from normal HTML tag
, i mean what is the exact reason to include runat = "server"
&
whats the different between general HTML
tag & an ASP.NET
tag without runat = "server"
?
Asked
Active
Viewed 3,605 times
3

Ashok Damani
- 3,896
- 4
- 30
- 48
-
1[Why does ASP.NET webforms need the Runat=“Server” attribute](http://stackoverflow.com/questions/304290/why-does-asp-net-webforms-need-the-runat-server-attribute) – Tim Schmelter May 24 '13 at 12:12
-
runat server means allt he Controls undergo Page Postback for Each Action – Akshay Joy May 24 '13 at 12:13
1 Answers
3
When the markup code is parsed, everything is converted into server controls.
Any elements that are not tagged with runat="server"
will just end up as a LiteralControl
control with the HTML code as text.
For example, markup like this:
<div>
<p>
<span id="asdf" runat="server"> </span>
</p>
</div>
will end up as the controls:
LiteralControl("<div><p>")
HtmlGenericControl("span") with id asdf
LiteralControl("</p></div>")

Guffa
- 687,336
- 108
- 737
- 1,005