By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,067 Members | 1,818 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,067 IT Pros & Developers. It's quick & easy.

Can User Control inherted from a User Controls?

P: n/a
ABC
I write a Base Web User Control which contains several public properties and
a Inherited Web User Control which only have some codes in new method. When
I use the Inherited Web User Control on Web Form, I don't know why the
Inherited Web User Control have not any properties inherited from Base Web
User Control.
How should I do?

The based web user control as:
using System;
....
....

namespace xxxx.UserControls
{
public class SystemTableDropDownListBase : System.Web.UI.UserControl
{

public SystemTableDropDownListBase() : base ()
{
...
}

public override void DataBind()
{
...
}

...

// Properties

public string ViewName
{
...
}

public string DataTextField
{
...
}

...
}
}

The Inherited Web User Control as:
namespace xxxx.UserControls
{
public class xxxxDropDownList : SystemTableDropDownListBase
{

public xxxxDropDownList() : base()
{
ViewName = "vstSalutation";
}
}


Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
When you Inherit from a base class. You do not see the base code in the
class definition of your derived class. However, if you have given anything
other than private as the accessor privilage , then you will be able to
'Use' those properties or methods etc from the derived class.

Hope this answers you question.

--
Best Regards

The Inimitable Mr Newbie


"ABC" <ab*@abc.com> wrote in message
news:eq*************@TK2MSFTNGP15.phx.gbl...
I write a Base Web User Control which contains several public properties
and a Inherited Web User Control which only have some codes in new method.
When I use the Inherited Web User Control on Web Form, I don't know why the
Inherited Web User Control have not any properties inherited from Base Web
User Control.
How should I do?

The based web user control as:
using System;
...
...

namespace xxxx.UserControls
{
public class SystemTableDropDownListBase : System.Web.UI.UserControl
{

public SystemTableDropDownListBase() : base ()
{
...
}

public override void DataBind()
{
...
}

...

// Properties

public string ViewName
{
...
}

public string DataTextField
{
...
}

...
}
}

The Inherited Web User Control as:
namespace xxxx.UserControls
{
public class xxxxDropDownList : SystemTableDropDownListBase
{

public xxxxDropDownList() : base()
{
ViewName = "vstSalutation";
}
}

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.