Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

visual inheritance in asp.net

I am wondering whether the visual inheritance feature in vb.net can be extended for asp.net webforms also!! ie. we do have a template form(like left/right includes and tables are boxed) and whenever we need to create a new asp page, we will COPY and PASTE all the code from the template and start inserting the controls into the inner most tables and we are done. But I am wondering if I can inherit from the base webform whenever I need to create a new webform, that will be great(both for visual and codebehind). I know usercontrols comes pretty close to this but I am not inheriting there. any thoughts??

Ram
Tuesday, July 15, 2003

Nope, use a user control.

Rick Childress (www25.brinkster.com/rchildress)
Tuesday, July 15, 2003

-Create a new class that inherits from System.Web.UI.Page (say MyPage).

-Add functions, subs, event handlers, etc. to this class that will be used by all your pages.

-Create a new page and change the code behind to inherit from MyPage instead of System.Web.UI.Page.

You will still need to write the html side of things, and do look into UserControls.

l.r. fisher
Tuesday, July 15, 2003

There is a long running thread on www.asp.net that discusses this very thing.

http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=4692

Michael

Michael J. Carter
Tuesday, July 15, 2003

User controls are actually pretty poor feature-wise. Why not just make a custom control and be done with it? :)

Brad Wilson (dotnetguy.techieswithcats.com)
Tuesday, July 15, 2003

Doh! Wrong thread. How'd that happen?

Brad Wilson (dotnetguy.techieswithcats.com)
Tuesday, July 15, 2003

'Create a new page and change the code behind to inherit from MyPage instead of System.Web.UI.Page.'


Are you sure this works l.r.?

I tried it back in the day when I was getting started with asp.net and couldn't get it to work...

Rick Childress (www25.brinkster.com/rchildress)
Tuesday, July 15, 2003

I do not want to use User Control as there is no inheritance. it is more like copy and paste. Custom controls are hard when it comes to maintaining a rich UI(like nested tables,header and footer). I was thinking of something like Windows form where you can inherit the UI once you are done with your basic UI.

Ram
Thursday, July 17, 2003

*  Recent Topics

*  Fog Creek Home