• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

Inherit Web Custom Control

I have a custom control that I purchased.  Everytime they come out with a new version, I have to recompile the project.  This is VERY annoying.

I was thinking if I created my own custom control that inherited from their custom control, I would then be able to just link my projects with my custom control, and then when new versions are released, just recompile my custom control.  I would also have the added benefit of overriding their control and be able to change the behavior of the control my adjusting my custom control.

I started out by creating my own web custom control library.  I then added the reference of the control that I bought to my custom control libary.  I then added a custom control and changed the class so that it is derived from their custom control.  Finally, I added a web-based project to the solution and attempted to add my library as a reference and then place the custom control on the web page.  Here is my inherited class:

namespace WebControlLibrary
{
      [ToolboxData("<{0}:MyWebCombo runat=server></{0}:MyWebCombo>")]
      public class MyWebCombo : ISNet.WebUI.WebCombo.WebCombo
      {
      }
}

My first problem is that the program wants me to add a reference to the original DLL.  I don't want to do this.  How I can setup this control do that I can just compile with my custom control libary?

Secondly, just for the purposes of trying to get this to work, I added the reference as the compiler suggested (even though I do not want to do this).  The project compiles, but I cannot the web page to load the custom control.  I get the error "Could not load type WebControlLibrary1.WebCustomControl1 from assembly WebControlLibrary1, Version 1.0.x.x, Culture=neutral, PublicTokenKey=null".  The DLL is being copied to the bin directory of the web page project.

Anyone who can tell me how to do this would be greatly appreciated.  I will need step by step instructions because I've never created a custom control before.
0
ardolino
Asked:
ardolino
1 Solution
 
raterusCommented:
To answer your first question, you cannot do this.  Unless you have access to the source code and can add it to your project, your custom class is only but a mere pointer to the original component.  The original reference is required.

Your second question may be a simple namespace class issue.  It says "Could not load type WebControlLibrary1.WebCustomControl1 from assembly WebControlLibrary1", but your code you posted would be "WebControlLibrary.MyWebCombo"
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now