How can you find a control in an ASP.NET page from code behind

Lets suppose we have an ASP.NET page and we have the following control in it: <asp:Label runat="server" ID="label1"></asp:Label> To find the control in the page from code behind, you have to do the following: Label lbl = this.FindControl("label1") as Label; This will work in any normal ASP.NET page, but will not work if you using a Master …

Continue reading How can you find a control in an ASP.NET page from code behind


Why is the virtual keyword used in code?

The virtual keyword is used while defining a class to specify that the methods and the properties of that class can be overridden in derived classes.

URL Routing in ASP.NET 4

Normally when you access a web page, you use a URL that is the physical path of the page. URL routing is a way to provide your own URL instead of the physical path. ASP.NET 4.0 provides us with a simple and strong way to handle URL routing. ASP.NET 4.0 router enables to define any …

Continue reading URL Routing in ASP.NET 4

Page Life Cycle in ASP.Net

With in Each stage of the life cycle the page raises Events that you can handle to run your own code. These are as follows 1-PreInit- Raised before the Initialization stage begins Here the Ispostback property is checked to determine wheather the first time the page is being processed. 2-Init- Raised after all the controls have been initialized. 3-Init complete: Raised at …

Continue reading Page Life Cycle in ASP.Net