p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   General .NET (http://p2p.wrox.com/forumdisplay.php?f=122)
-   -   User Control Inheritence. (http://p2p.wrox.com/showthread.php?t=22350)

ochanarachel December 9th, 2004 10:27 AM

User Control Inheritence.
 
Hellow.

General:
I'm developing asp.net application.
I need to write several properties that are common to
all control types : datagrid,checkbox,button...ecxt.

problem:
[u]option A:</u>
should i inherit a control from System.Web.UI.UserControl
and then inherit again for each type.
for example:
1. MyBaseControl:System.Web.UI.UserControl.
2. MyDataGrid:MyBaseControl.
3. Place a DataGrid on it.
and repeat step 2,3 for each control type ?

[u]Option B</u>
Inherit diractly : MyDataGrid from DataGrid,MyCheckBox from CheckBox....

Please help..
Thanks inadvance.
Racheli.


Rana December 10th, 2004 11:21 AM

If you want just to extend the existing functionality of a control, I think option B is right way to go.

checkout this link to see how datagrid can be extended if you need..

http://msdn.microsoft.com/msdnmag/is...e/default.aspx

Hope it helps

ochanarachel December 24th, 2004 06:07 PM

hi.
[u]General </u>
I inherited datagrid from : System.Web.UI.WebControls.DataGrid.
I have added "Register" tag and put my Datagrid on the page. it look like: <cc1:MyDatagridControl></cc1:MyDatagridControl>
.
[u]Problem</u>
I am tring to add ItemTemplate column or any one of the embeded tags
of Asp:DataGrid Controle.
I accept Error[u]:The active schema does not support the element ItemTemplate'</u>

Please help.
do i have to implements method in the inherited class?

THANKS INADVANCE Racheli.


planoie January 11th, 2005 11:09 AM

As far as Visual Studio is concerned it doesn't recognize "cc1:MyDatagridControl" as anything meanful to the intellisense logic. But you can use the standard datagrid markup for columns and settings as long as your control is inherited from the standard datagrid control. There may be ways to change this so that visual studio recognizes your control, but I've never played with it. When I'm setting up my markup I usually just create a regular datagrid so I can get the intellisense then just copy over the markup to my custom control.


All times are GMT -4. The time now is 05:16 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.