Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

inheriting the .aspx pages?

Tags:

asp.net

Can we inherit the aspx page into another aspx page. If yes how can we do that, Thank you.

like image 274
Surya sasidhar Avatar asked May 08 '11 19:05

Surya sasidhar


2 Answers

I think there are two things you should consider here::

1.Create a new base page type, and have your codebehind classes inherit from that, e.g.:

public abstract class MyPageBase : System.Web.UI.Page
{
    // Implement custom shared logic here.
}

2.Move some of your page control logic into partial controls that you can inject into other pages.

like image 139
Matthew Abbott Avatar answered Sep 17 '22 21:09

Matthew Abbott


I don't think so. You can however, create a master page and use it in the pages you want. That is the way "inheritance" of aspx pages works.

Master page tutorials:

http://www.asp.net/master-pages/tutorials

like image 23
Miguel Angelo Avatar answered Sep 17 '22 21:09

Miguel Angelo