S
Shak
All,
What is the best way to inherit from an existing webform? I have a simple
ASP page which displays the results of a DB query in a datagrid.
I now want to use the existing code, to display the results of a different
query, but with the same peripheral code (formatting of the datagrid for
instance).
I've managed to get this working as so:
1) Create a new webform and inherit this in the c# from the base form
instead of Page.
2) Cut and paste the HTML generated for the base form, changing the
codebehind and inherits to point to the subclass form.
Now this works, until VS.NET decides to (by looking at the HTML, I presume),
add a new datagrid variable to the subclass. If I delete this declaration
then everything wroks as I intend. However flicking back and forth between
design and code views always regenerates these decs.
Am I doing something wrong? If not, is there a workaround?
Shak
What is the best way to inherit from an existing webform? I have a simple
ASP page which displays the results of a DB query in a datagrid.
I now want to use the existing code, to display the results of a different
query, but with the same peripheral code (formatting of the datagrid for
instance).
I've managed to get this working as so:
1) Create a new webform and inherit this in the c# from the base form
instead of Page.
2) Cut and paste the HTML generated for the base form, changing the
codebehind and inherits to point to the subclass form.
Now this works, until VS.NET decides to (by looking at the HTML, I presume),
add a new datagrid variable to the subclass. If I delete this declaration
then everything wroks as I intend. However flicking back and forth between
design and code views always regenerates these decs.
Am I doing something wrong? If not, is there a workaround?
Shak