converting ascx to dll ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • miladhatam@gmail.com

    converting ascx to dll ?

    hi
    i've made a Web User Control (ascx file)
    i want to convert it to "dll" file and put it in my toolbox
    ofcourse i 've built my project but the dll of my Web User Control is
    useless
    how can i do it with VS 2008?
  • Cowboy \(Gregory A. Beamer\)

    #2
    Re: converting ascx to dll ?

    There is no automagic way to convert from ASCX to server control. And I am
    not sure there is a tool out there, as the permeatations of what you might
    accomplish are huge.

    The way to do it is to look at the rendered output and create a render
    method. Any helper methods, that do not touch controls, can be copied
    verbatim from the code behind to the class. You then have to compile and
    test, as it is a UI component. Once you do this a few times, you will be
    well versed enough to create server controls without the intermediate user
    control stage.

    I wish I had a better answer and would love if someone could say Product X
    does this. Good luck!

    --
    Gregory A. Beamer
    MVP, MCP: +I, SE, SD, DBA

    Subscribe to my blog


    or just read it:


    *************** *************** **************
    | Think outside the box! |
    *************** *************** **************
    <miladhatam@gma il.comwrote in message
    news:323a296a-6b99-4900-87bb-d6af86652328@l4 2g2000hsc.googl egroups.com...
    hi
    i've made a Web User Control (ascx file)
    i want to convert it to "dll" file and put it in my toolbox
    ofcourse i 've built my project but the dll of my Web User Control is
    useless
    how can i do it with VS 2008?

    Comment

    • =?Utf-8?B?TG91aXMgU29tZXJz?=

      #3
      RE: converting ascx to dll ?

      This was one of the pitfalls I first fell in when starting with ASP.Net!

      Usercontrols, or pages, or anything with an aspx / ascx file cannot be used
      as a base class to inherit from!

      My current conception about these files (I'm presuming and assuming quite
      allot now) is as follows: The as?x file is dynamically compiled by the ASP
      runtime when requested and somehow inherits from the compiled dll (which
      includes the code-behind stuff). It's simply a static file that sets up an
      hyrarchy of controls and sets their initial properties.

      You cannot see it as a winforms usercontrol, wich is simply a class from
      which you can inherit. For ASP, if you want to inherit from a basic
      usercontrol, you are not able to create it using the designer, but will have
      to do everything in code, inheriting from Control or so, not using any as?x
      xml stuff.

      "miladhatam@gma il.com" wrote:
      hi
      i've made a Web User Control (ascx file)
      i want to convert it to "dll" file and put it in my toolbox
      ofcourse i 've built my project but the dll of my Web User Control is
      useless
      how can i do it with VS 2008?
      >

      Comment

      • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

        #4
        RE: converting ascx to dll ?

        this can be done with a combination of using the aspnet_compiler and
        aspnet_merge. you will end up with really ugly assembly names, but it will
        work. you should study these tools and understand how the aspnet_compiler
        builds and names output files. (adds a hash based on directory name to
        assembly). you can also use the webdeployment project, and just find the dll
        that represents the user control.

        a better longterm approach might be to compiel you site to a single dll, and
        use reflector to extract the code generated by asp.net compielr for the ascx.
        use this to build a real control.


        -- bruce (sqlwork.com)


        "miladhatam@gma il.com" wrote:
        hi
        i've made a Web User Control (ascx file)
        i want to convert it to "dll" file and put it in my toolbox
        ofcourse i 've built my project but the dll of my Web User Control is
        useless
        how can i do it with VS 2008?
        >

        Comment

        • Marko

          #5
          Re: converting ascx to dll ?

          There is no automagic way to convert from ASCX to server control. And I
          am
          not sure there is a tool out there, as the permeatations of what you
          might
          accomplish are huge.
          Off course. There is no automatic way. You can read info at:



          Comment

          • Cowboy \(Gregory A. Beamer\)

            #6
            Re: converting ascx to dll ?

            Where there is a will, there is a way. ;-)

            --
            Gregory A. Beamer
            MVP, MCP: +I, SE, SD, DBA

            Subscribe to my blog


            or just read it:


            *************** *************** **************
            | Think outside the box! |
            *************** *************** **************
            "Marko" <marko_p@gmail. comwrote in message
            news:gbqbc8$tbi $1@sunce.iskon. hr...
            There is no automagic way to convert from ASCX to server control. And I
            am
            not sure there is a tool out there, as the permeatations of what you
            might
            accomplish are huge.
            >
            Off course. There is no automatic way. You can read info at:

            >
            >

            Comment

            Working...