S
SoftLion
Hi,
I've created a default asp.net web page and dragged a DataGrid inside it.
I would like to create a simple custom class derived from DataGrid to hide
all relevant code in it, instead of putting the code (especially for the
events) in the _default class.
This class is called DGMGrid2. I replaced the declaration :
protected System.Web.UI.WebControls.DataGrid DataGrid1;
with
protected DGMGrid2 DataGrid1;
public class DGMGrid2 : System.Web.UI.WebControls.DataGrid
{
public void DMGrid2() {}
}
That should work ?
It compiles OK but when executed there is a parse error:
Parser Error Message: The base class includes the field 'DataGrid1', but its
type (Foo.DGMGrid2) is not compatible with the type of control
(System.Web.UI.WebControls.DataGrid).
Error:
Line 20: <ASP
ATAGRID enableviewstate="false" id="DataGrid1"
runat="server" showfooter="False" width="100" cellpadding="2" pagesize="100"
autogeneratecolumns="False" horizontalalign="Center">
What is the right way to do that ?
Thanks !!
I've created a default asp.net web page and dragged a DataGrid inside it.
I would like to create a simple custom class derived from DataGrid to hide
all relevant code in it, instead of putting the code (especially for the
events) in the _default class.
This class is called DGMGrid2. I replaced the declaration :
protected System.Web.UI.WebControls.DataGrid DataGrid1;
with
protected DGMGrid2 DataGrid1;
public class DGMGrid2 : System.Web.UI.WebControls.DataGrid
{
public void DMGrid2() {}
}
That should work ?
It compiles OK but when executed there is a parse error:
Parser Error Message: The base class includes the field 'DataGrid1', but its
type (Foo.DGMGrid2) is not compatible with the type of control
(System.Web.UI.WebControls.DataGrid).
Error:
Line 20: <ASP
runat="server" showfooter="False" width="100" cellpadding="2" pagesize="100"
autogeneratecolumns="False" horizontalalign="Center">
What is the right way to do that ?
Thanks !!