ASP.NET Web Forms

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.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“An expert is a man who has made all the mistakes that can be made in a very narrow field” - Niels Bohr