Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 9th, 2004, 10:27 AM
Registered User
Join Date: Oct 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default User Control Inheritence.


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

[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.

Old December 10th, 2004, 11:21 AM
Authorized User
Join Date: Nov 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

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..


Hope it helps
Old December 24th, 2004, 06:07 PM
Registered User
Join Date: Oct 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

[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>
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?


Old January 11th, 2005, 11:09 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

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.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inheritence with System.object class NeoNeo C# 2 May 24th, 2006 06:38 AM
Inheritence with System.object class NeoNeo BOOK: Professional C#, 2nd and 3rd Editions 0 May 23rd, 2006 12:59 PM
Add Windows User control in Web User Control agarwalvidhu C# 0 March 30th, 2006 01:17 AM
Help! Custom Server Control using User Control diehard ASP.NET 1.0 and 1.1 Professional 2 January 4th, 2006 12:33 PM
Help with control initialization in user control mike_remember ASP.NET 1.0 and 1.1 Professional 7 December 19th, 2005 11:08 AM

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