Server-side Code Blocks
Code to be executed on the server is contained inside a set of <script>
</script> tags, similar to the tags you would use to add client-side
code to a Web page. In order for the page compiler to process the source code
on the server, you must add a runat="server" attribute to
the tag. Page logic, including the handling of events such as the Page_Load()
event, is found in server-side code blocks rather than on the client side.
|
Note If the runat="server" attribute is not specified, then
the tag will be passed to the client as is. This causes unpredictable results,
depending on the tag in question. In the case of ASP.NET Web controls, the
browser will most likely ignore the tag entirely. HTML controls will then
be displayed on the client, but they will not be accessible to ViewState management
or server-side validation.
|