Tricky problem with WebControl vs. Panel

  • Thread starter Ovidiu Birladeanu via .NET 247
  • Start date
O

Ovidiu Birladeanu via .NET 247

I have built a class derived from WebControl, and added somespecific functionality to it..Then I built a set of web controlsbased on that class...Everything works fine, until i needed apanel like functionality and all my stuff..All I could do iscreate a web control derived from WebControls.Panel andDUPLICATE all the code for that "specific functionality"..Now ihave a lot of classes and a lot of code writed twice..C# doesnot supports multiple inheritance,so the only solution (besidesthat code duplication) would be to find a way, by usingattributes and methods, to enable a class derived fromWebControl to act as a Panel ( drag & drop and stuff)..I'vetryed a lot of methods but i get stuck to that "Invalidparameter" error.
I don't need much, just a hint to start digging :(..

Thanx in advance,
Ovidiu
 
D

David Jessee

would this get you what you need?

public class MyPaneledControl: OtherControl{

private Panel containerPanel;


public void Render(writer){
containerPanel.Controls.Add(this);
containerPanel.RenderControl(writer);
}
}
I have built a class derived from WebControl, and added some specific
functionality to it..Then I built a set of web controls based on that
class...Everything works fine, until i needed a panel like functionality and
all my stuff..All I could do is create a web control derived from
WebControls.Panel and DUPLICATE all the code for that "specific
functionality"..Now i have a lot of classes and a lot of code writed
twice..C# does not supports multiple inheritance,so the only solution
(besides that code duplication) would be to find a way, by using attributes
and methods, to enable a class derived from WebControl to act as a Panel (
drag & drop and stuff)..I've tryed a lot of methods but i get stuck to that
"Invalid parameter" error.
I don't need much, just a hint to start digging :(..

Thanx in advance,
Ovidiu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top