You are currently viewing Namespaces, Events or Methods in ASP.Net Web Forms

In this article we will see the basics of Namespaces, Events or Methods in ASP.Net Web Forms.

Namespace:
Anything which displays {} in front of them is namespace. It is collection of classes. It may be nested. System is the root namespace of Microsoft. Following are some common namespaces that are inbuilt in code file of web page. In ASP.Net, file with extension .aspx is the webpage where you can design your page and type your html and file with extension .cs is the code file where you can write the logic or code and cs denotes that the coding is in C#. There are following some common system namespaces which will automatically inbuilt when you made a web application.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

These are all namespaces defined by Microsoft. We have to use these. We can also create our own namespaces using following syntax.

namespace firstnamespace
{
    // statements----
}

 

Events or Methods
Events always fire and methods always call.
Events automatically fire on a particularly interval. Intervals are fixed and does not made by us i.e. already made. For example  – Page Load Event fire when a request for particular page goes to server.
A method may be a function or may be procedure. Function returns a value while Procedure does not return value.
Events have only two parameters:- 1st parameter: for reference and 2nd parameter: To manage event data.

 

Dinesh Kumar Bansal

Dinesh Kumar Bansal is an Indian Software Developer, who is working on ASP.Net, MS-SQL, SAP-ABAP technologies from last one year. His Basic Principle of developing software is, “You have to clear about, what do you want to do, how can it be done”. He always says that development can be done with a cool & fresh mind.

Leave a Reply