Inherit Web Custom Control

Posted on 2005-04-22
Last Modified: 2010-05-18
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.
Question by:ardolino
    1 Comment
    LVL 33

    Accepted Solution

    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"

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now