generic web page creation ???

Discussion in 'ASP .Net' started by Chris Peeters, Jun 29, 2009.

  1. Hi.

    Instead of having 2 webforms that do similar things, apart from the type
    of data they are using, I want to create a generic version of the page

    So, instead of having 2 classes

    public partial class IntPage : System.Web.UI.Page
    {
    public IntPage()
    {
    List<int> i = new List<int>();
    }
    }

    public partial class StringPage : System.Web.UI.Page
    {
    public StringPage()
    {
    List<string> i = new List<string>();
    }
    }

    do i want just one, something like

    public partial class TestPage<T> : System.Web.UI.Page
    {
    public TestPage()
    {
    List<T> i = new List<T>();
    }
    }

    And so, based on the request of the client does he get the int-page or
    the string-page.

    But how to implement this ? In order to create an instance of the
    generic class, where do i write the instance creation code?

    Where is the point in the request-pipeline where the instance of a
    webpage is created, in other words, where can i write my generic class
    creation, something like :

    HttpContext.Current.Handler = new TestPage<int>();
    or
    HttpContext.Current.Handler = new TestPage<string>();


    any help greatly appreciated

    thank you

    Chris

    *** Sent via Developersdex http://www.developersdex.com ***
    Chris Peeters, Jun 29, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?dmlqYXk=?=

    Creation of new web pages from the existing web page

    =?Utf-8?B?dmlqYXk=?=, May 12, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    407
    =?Utf-8?B?dmlqYXk=?=
    May 12, 2004
  2. Murat Tasan
    Replies:
    1
    Views:
    8,009
    Chaitanya
    Feb 3, 2009
  3. Replies:
    2
    Views:
    407
  4. Marc van Dongen

    Generic Array Creation

    Marc van Dongen, Feb 5, 2009, in forum: Java
    Replies:
    9
    Views:
    2,576
  5. minlearn
    Replies:
    2
    Views:
    435
    red floyd
    Mar 13, 2009
Loading...

Share This Page