generic web page creation ???

C

Chris Peeters

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top