locked
Creating a WebUserControl in separate DLL RRS feed

  • Question

  • User697542070 posted

    Hi, I want to create a dll file with WebUserControl (ascx and cs file). Can I? I don`t see a template for it.

    If I can not, is there other way to achieve this goal?

    Thanks, radco

    Thursday, January 17, 2008 7:56 AM

Answers

  • User1329368652 posted

    It's my understanding that you can't do that. If you want to create a class library to distribute as a dll, you need to create custom server controls that override the base webcontrol classes. But, I could be wrong. It's been known to happen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 18, 2008 7:44 AM
  • User697542070 posted

    You are right, I was searching two hours on msdn and I found an article where user and custom controls were compared

    radco

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 18, 2008 8:06 AM

All replies

  • User1329368652 posted

    What you might be looking for is a Web Control Library. This will allow you to build a project of custom web controls that you can compile into a dll and then use in any project. Start a new porject and select Visual C# > Windows > Web Control Library. Then in the project you can add new Web Custom Controls.

     Below are a couple of links to get you started:

    http://msdn.microsoft.com/en-us/library/aa710843(VS.71).aspx

    http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx

    http://www.15seconds.com/issue/040421.htm

    Thursday, January 17, 2008 9:02 AM
  • User697542070 posted

    Well it is true, what you have written, but you didn`t understand my problem. I can create a new control by deriving from existing (using a file with cs extension) in that kind of project. The problem is that in this way I need to override RenderContent method and create a result using code. I would like to create a .ascx file and there I want to use Design mode (it is easier and much faster when I see the result than if I need to concat strings to make the same)

    Thursday, January 17, 2008 1:03 PM
  • User1329368652 posted

    It's my understanding that you can't do that. If you want to create a class library to distribute as a dll, you need to create custom server controls that override the base webcontrol classes. But, I could be wrong. It's been known to happen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 18, 2008 7:44 AM
  • User697542070 posted

    You are right, I was searching two hours on msdn and I found an article where user and custom controls were compared

    radco

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 18, 2008 8:06 AM
  • User1275668648 posted

    you might both be wrong:

     

    "Turning an .ascx User Control into a Redistributable Custom Control"

    http://msdn.microsoft.com/en-us/library/aa479318.aspx

       

    Unfortunately, it does not work when the control includes images or javascript files-- they don't get embedded in the dll. It's possible that even the ascx file does not get embedded.

    I'm hoping it will be possible to resolve that issue using the following embedding method:

     

    Embedding Resources in ASP.NET 2.0 Assemblies

    http://aspalliance.com/726

     

    I have not tried it, maybe someone with free time could try it, and post their results here?...

    Monday, April 21, 2008 3:53 PM