Results 1 to 3 of 3

Thread: How to create a new web form which inherites from a base web form

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Hong Kong
    Posts
    38

    How to create a new web form which inherites from a base web form

    This may be a simple question but I am learning, and would very much appreciated for suggestions.

    Usually we make all pages of a web site having a common appearance, say, fixed frame areas, headers and footers etc. Of course in .NET we implement every page with a web form. But how can I draw a standard, base webform with some fixed wordings, controls, links etc so that all other pages look the same to it. I guess inheritance should be a proper choice, but I can't find a wizard feature like the "window form" project where we can add "inherited window form".

    I know that we can define a class with inheritance from System.Web.UI.Page, then we can build new pages by inheritating from this BasePage.

    Coding as follows:

    Namespace MyPages
    Public Class BasePage
    Inherits System.Web.UI.Page

    Public Function Whatever()
    ....Function Goes Here
    End Function
    End Class
    End Namespace

    However, this gives me a new class only, not a aspx file and there is no designer associated with it so that I cannot easily add in controls by dragging and dropping from the toolbox.

    What would be a proper way to create a new web form from a base web form ?

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    I believe you want pagelets


    see my reply here
    http://www.vbforums.com/showthread.p...hreadid=165236
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Hong Kong
    Posts
    38
    Hi, Chris,

    Thanks for your suggestion. I also found a very good article about the subject at

    http://msdn.microsoft.com/library/de...ercontrols.asp

    I just wonder why Microsoft leaves us to do the manual editing to remove the html tag etc for conversion and not offer an menu choice like inheriting a window form to do the job.

    Regards.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width