Inherit from a web form/page

T

Tim

I created a base web form class that has common functionality that I can use
across the rest of the site. I am trying to inherit from the base web form
class but the controls (i.e. textbox, buttons...) are not displaying on the
child web page (class). Is there a trick to inheriting from a web page? Is
it even possible?

This is a snippet from the base class...
public class Search : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox TextBox1;
private void Page_Load(object sender, System.EventArgs e){}
....

This is a snippet from a child...
public class InternalSearch : Search
{
private void Page_Load(object sender, System.EventArgs e){}
.....

Thanks for your help!
 
N

nfedin

The way I had done it is to create the base class with a bunch of
public Placeholder controls. When I instantiate the class(page_load)
I then insert the page controls that I want in each placeholder. The
base class then displays all the common stuff and then displays the
placeholder(s) too...

Neil
 

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

Top