473,789 Members | 2,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2316
"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 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
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 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.
Nov 1 '07 #4

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

Similar topics

10
2705
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 User Controls are themselves custom controls. Occasionally, when I change something in either the User Control and/or one of the custom controls that are on it and recompile, when I go to the "Visual" design surface of the User Control, the...
1
7588
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 dropdown in UC1 _________________________ 1) MainPage_Load 2) User Control_1 Load
0
1319
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 at the end of this message. The Microsoft documentation is a bit confusing to me. The following numbered sentences appear in the .NET Framework Developer's Guide article titled "Caching Portions of an ASP.NET Page": 1. You can declare an ID...
1
3392
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 comprised of a DataGrid may have separate permissions for adding, deleting and updating a news item. Problem Up until now, I have been implementing security directly inside the control. I will test directly against the security model to see if...
11
11577
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 object and displays the data correctly when I move from row to row. The problem I am having is the data set always reads the data back and considers it change even when it's not. I am looking for how to change the following code so the...
6
11082
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 how those properties are set. I want to be able to do two other things: a) add User control instances to my page, filling in the place of placeholder controls, and b) programmatically setting custom properties on those dynamically spawned...
2
1435
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 control for and possibly email a zip file with that control so I could run it in a program to see how it worked? to pts4560 <atyahoo.com ? thanks.
2
3010
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 language=vb runat=server>
3
1355
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 know that I can create a user control and add it within the aspx file or dynamically to a page, but can I do the same within a custom control so that I can reuse this as a whole Pane. I wish to do this so that I can dynamically add new panes with...
4
2493
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 unsuccessfully in creating the whole pane as a user control and have succeeded in adding the pane and then dynamically adding the content which is a user control to the pane, dynamically within the page. However I would like to have a single pane...
0
9665
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10199
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6768
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3697
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.