473,396 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

User control to custom control

JJ
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
Oct 29 '07 #1
3 2295
"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
Oct 29 '07 #2
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 programmatically 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
Oct 30 '07 #3
Hi JJ,

Have you got any progress or do you have any further questions? If so,
please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: st*****@online.microsoft.com (Steven Cheng[MSFT])
Organization: Microsoft
Date: Tue, 30 Oct 2007 04:17:48 GMT
Subject: RE: User control to custom control
>
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 programmatically 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.
Nov 1 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: BBM | last post by:
Hi, I have been developing with C# User Controls and occasionally have a problem where I "lose" a control from the design surface of the User Control. The controls that I am using to build my...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
0
by: Jeff Schaefer | last post by:
What I want to know is this: Is it possible to programmatically manipulate a custom property of a user control for which <%@ OutputCache ... > has been included? If so, then how? My brief code is...
1
by: Earl Teigrob | last post by:
Background: When I create a ASP.NET control (User or custom), it often requires security to be set for certain functionality with the control. For example, a news release user control that is...
11
by: John J. Hughes II | last post by:
I have a DataGridView displaying data from a DataSet. To the right of that I have a custom user control which displays one of the data set fields. The custom user control is bound to the data set...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
2
by: Ron | last post by:
I would like some more information on custom controls, what they can do and things like that, what you would use them for etc... Can anyone here share some examples of what you have used a custom...
2
by: User | last post by:
Hi, I have a custom user control. How do I write the script in a way which i can import custom namespace within the custom control? Please advise.. Thanks! mycontrl.ascx <script...
3
by: RichB | last post by:
I would like to use the AJAX ASP.NET Accordion Control. Can I create a user control for the form and include this within a custom control which inherits from a Pane of the Accordion control? I...
4
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.