• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

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