Thanks for Peter's input.
Hi JJ,
So far for template based control (ascx usercontrol and ASPX page), there
hasn't any good means to directly convert them into custom control.
However, I think the following means is worth a try:
Since ASP.NET will dynamically compile ASPX or ascx into dynamic class at
runtime, you can manually use precompilation to precompile the website and
get the precompiled assemblies(you can choose non-updatable so that ascx ,
aspx will also be precompiled into assembly). After that you can use
reflector utility to inspect the precompiled code which should contains the
code that programmaticall y construct the ascx/aspx UI. Of course, you need
to modify them since those dynamically generated code is not quite human
readable, but can be used as a reference. How do you think?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Subject: RE: User control to custom control
Date: Mon, 29 Oct 2007 09:43:00 -0700
>
"Best" way, dunno. But essentially you need to get the UI generation of
the
>UserControl ascx elements into the CustomControl's various Render methods.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder : http://www.blogmetafinder.com
"JJ" wrote:
>Whats the best way to convert a user control to a custom server control?
i.e. I created a .aspx control using the designer to create the look of
the
>control. I now want to use this in other projects and compile it as a
dll.
>However, I understand that I now need to create the controls interface
elements via code. Is there a way to easily translate a previously
created
>interface to be created by code?
Not sure I am making myself very clear but hopefully someone will be
able to
>understand.. .
Thanks
JJ