473,498 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Instantiate UserControl without LoadControl

Hi.

This is a question about ASP.NET 2.0.

How can I instantiate a UserControl without
the method LoadControl?

I need to create a usercontrol from
a .ascx file that is out of the web application,
it's placed into a virtual directory.

Thanks!

Matteo Migliore.
Nov 19 '05 #1
1 1577
In the ASP.NET model, user controls are the down and dirty way to get
repetitive functionality without complete black boxing your code. It is a
compromise between flexibility and full encapsulation. Because of the
compromise, you are stuck in a tigher box than you are with compiled code.

I can think of a possible kludge and fix for this issue:

The kludge is to aim at the source file and reflect emit in your
application. Have not tried with a user control, but it "should" work with
some tweaking.

The fix is to move your code to a library as a server control. This will
take more time.

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

***************************
Think Outside the Box!
***************************
"Matteo Migliore" wrote:
Hi.

This is a question about ASP.NET 2.0.

How can I instantiate a UserControl without
the method LoadControl?

I need to create a usercontrol from
a .ascx file that is out of the web application,
it's placed into a virtual directory.

Thanks!

Matteo Migliore.

Nov 19 '05 #2

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

Similar topics

2
6733
by: Ben de Vette | last post by:
Hi, I like to load a UserControl onto a placeholder with some more control then just doing protected System.Web.UI.WebControls.PlaceHolder placeHolder; UserControl ascx =...
4
3087
by: Harry | last post by:
Hello, I have a page with a RadioButtonList and a PlaceHolder control. The RadioButtonList's AutoPostBack attribute is set to TRUE and its SelectedIndexChanged event loads one of three...
6
1966
by: Anonymous | last post by:
Hello, I am loading a usercontrol with the LoadControl method and need to pass some data to the property of that control. How can I do that? THanks
2
4585
by: Sascha | last post by:
Hi there, I searched carefully through the web before finally deciding to post this message, because I could not find a solution for my problem. Hopefully someone will have a hint or explanation...
2
1949
by: jon | last post by:
I'm trying to establish how to replace a usercontrol that has already been loaded (using LoadControl in the Page.Load event) with a different UserControl following a PostBack. Tying to call...
4
1571
by: Alexander Widera | last post by:
How can I include an usercotrol into an other usercontrol... for example: <UserControl:First runat="server" id="firstUC" content="..." /> and i want to refer an other UserControl (e.g. called...
12
2178
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control...
2
1579
by: acadam | last post by:
In my application I have a usercontrol called "base" with a panel called "pnl1"; in "pnl1" I put my usercontrol. Now I would like to have 2 possibilities: from "base" to load another control...
7
1869
by: Nathan Sokalski | last post by:
I have a UserControl (*.ascx) that has the following design: <div id="divFileDir" runat="server"> <asp:Image ID="imgIcon" runat="server" CssClass="icon" Height="16px" Width="16px"/>...
0
7002
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
7165
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,...
0
7203
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...
1
6885
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...
0
5462
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,...
0
4588
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...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.