Search:
Namespaces
Discussions
.NET v1.1
Feedback
Not Ansered: I would like to know how to dymamically register user controls .ascx onto a parent user control
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngfreeforall' list
.
Dennis West
I would like to know how to dymamically register user controls .ascx onto a parent user control
from a dropdownlist of user controls, i would like to build a user control that would dynamically register (place) user controls within its own body. this is just an idea or what I want. It most likely is not in any way the way to do it. I just need some guidance on how to allow a user to select a control from a list and register that control onto another parent control.
<%@ Control language="vb" Inherits="Parent" CodeBehind="Parent.ascx.vb" AutoEventWireup="false" %>
<%@ Register TagPrefix="??Control1" TagName="??Control1" Src="??Control1" %>
<%@ Register TagPrefix="??Control2" TagName="??Control2" Src="??Control2" %>
<table width="100%" bgcolor="#C2C2C2" cellspacing="0" cellpadding="0" runat="server">
<tr>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control1:??Control1 id="??Control1??" bgcolor="#C2C2C2" runat="server" />
</td>
</tr>
</tbody>
</table>
</td>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control2:??Control2 id="??Control2??" runat="server" />
</td>
</tr>
<tr>
</tbody>
</table>
</td>
</tr>
</table>
http://aspalliance.com/dotnetsolutions/
Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address
Reply to this message...
Tim Heuer
Take a look at the LoadControl method.
From within your code, you can dynamically load a control and place it
somewhere on your page or where a placeholder may exist.
-th
______________________
Tim Heuer
-----Original Message-----
From: Dennis West [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 13, 2002 11:49 AM
To: aspngfreeforall
Subject: [aspngfreeforall] Not Ansered: I would like to know how to
dymamically register user controls .ascx onto a parent user control
I would like to know how to dymamically register user controls .ascx
onto a parent user control
from a dropdownlist of user controls, i would like to build a user
control that would dynamically register (place) user controls within its
own body. this is just an idea or what I want. It most likely is not in
any way the way to do it. I just need some guidance on how to allow a
user to select a control from a list and register that control onto
another parent control.
<%@ Control language="vb" Inherits="Parent" CodeBehind="Parent.ascx.vb"
AutoEventWireup="false" %>
<%@ Register TagPrefix="??Control1" TagName="??Control1"
Src="??Control1" %>
<%@ Register TagPrefix="??Control2" TagName="??Control2"
Src="??Control2" %>
<table width="100%" bgcolor="#C2C2C2" cellspacing="0" cellpadding="0"
runat="server">
<tr>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control1:??Control1 id="??Control1??" bgcolor="#C2C2C2"
runat="server" />
</td>
</tr>
</tbody>
</table>
</td>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control2:??Control2 id="??Control2??" runat="server" />
</td>
</tr>
<tr>
</tbody>
</table>
</td>
</tr>
</table>
<%@ Register TagPrefix="Portal1" TagName="Title"
Src="~/DesktopModuleTitle.ascx"%> <%@ Control language="vb"
Inherits="ASPNetPortal.PaneDivider" CodeBehind="PaneDivider.ascx.vb"
AutoEventWireup="false" %><%@ Register TagPrefix="ActiveDataOnline"
TagName="GroupCalendar" Src="~/GC_CalendarUserControl.ascx" %>
http://aspalliance.com/dotnetsolutions/
Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
Reply to this message...
chris
Dennis,
It is not always neccessary to Register your usercontrols at the top of your
page. If you want to do it in your codebehind, I would suggest adding a
Placeholder at the points in your aspx page where you would like to place
your dynamic user controls. then, in your code use the
Page
.LoadControl("virtualPath") method to load them. ex:
<ex>
PlaceHolder1.Controls.Add(LoadControl("myControl.ascx"));
</ex>
hth,
-Chris Frazier
.NET Solution Developer
Velocity Databank, Inc.
www.velocitydatabank.com
-----Original Message-----
From: Dennis West [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 13, 2002 1:49 PM
To: aspngfreeforall
Subject: [aspngfreeforall] Not Ansered: I would like to know how to
dymamically register user controls .ascx onto a parent user control
I would like to know how to dymamically register user controls .ascx onto
a parent user control
from a dropdownlist of user controls, i would like to build a user control
that would dynamically register (place) user controls within its own body.
this is just an idea or what I want. It most likely is not in any way the
way to do it. I just need some guidance on how to allow a user to select a
control from a list and register that control onto another parent control.
<%@ Control language="vb" Inherits="Parent" CodeBehind="Parent.ascx.vb"
AutoEventWireup="false" %>
<%@ Register TagPrefix="??Control1" TagName="??Control1" Src="??Control1"
%>
<%@ Register TagPrefix="??Control2" TagName="??Control2" Src="??Control2"
%>
<table width="100%" bgcolor="#C2C2C2" cellspacing="0" cellpadding="0"
runat="server">
<tr>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control1:??Control1 id="??Control1??" bgcolor="#C2C2C2"
runat="server" />
</td>
</tr>
</tbody>
</table>
</td>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control2:??Control2 id="??Control2??" runat="server" />
</td>
</tr>
<tr>
</tbody>
</table>
</td>
</tr>
</table>
http://aspalliance.com/dotnetsolutions/
Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com
= NEWSGROUP
Reply to this message...
Dennis West
Messagetim, what i need is to be able to select from a list of names that idendifies user controls that i have in a directory. From this selectable list I need a glue as to how to dynamically inserted a control (register it)into a script like this.. I belive I need to build this script programmiccally. using variables...
like this
<%@
Page
Language='VB'%>
<%@ Reference Control='Logonform.vb.ascx' %> this would be a variable
<html>
<body>
<script language="VB" runat="server">
Sub Page_Init(Sender As Object, e As
EventArgs
)
Response.Write("<h4><b> A Reusable Simple User Control</b></h4><br>")
'Obtain a
UserControl
object 'LogOnControl' from the user control file 'Logonform.ascx'.
Dim myControl As LogOnControl = CType (LoadControl("Logonform.vb.ascx"),LogOnControl)
Controls.Add(myControl)
End Sub
</script>
</body>
</html>
----- Original Message -----
From: Tim Heuer
To: aspngfreeforall
Sent: Tuesday, August 13, 2002 1:41 PM
Subject: [aspngfreeforall] RE: Not Ansered: I would like to know how to dymamically register user controls .ascx onto a parent user control
Take a look at the LoadControl method.
From within your code, you can dynamically load a control and place it somewhere on your page or where a placeholder may exist.
-th
______________________
Tim Heuer
-----Original Message-----
From: Dennis West [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 13, 2002 11:49 AM
To: aspngfreeforall
Subject: [aspngfreeforall] Not Ansered: I would like to know how to dymamically register user controls .ascx onto a parent user control
I would like to know how to dymamically register user controls .ascx onto a parent user control
from a dropdownlist of user controls, i would like to build a user control that would dynamically register (place) user controls within its own body. this is just an idea or what I want. It most likely is not in any way the way to do it. I just need some guidance on how to allow a user to select a control from a list and register that control onto another parent control.
<%@ Control language="vb" Inherits="Parent" CodeBehind="Parent.ascx.vb" AutoEventWireup="false" %>
<%@ Register TagPrefix="??Control1" TagName="??Control1" Src="??Control1" %>
<%@ Register TagPrefix="??Control2" TagName="??Control2" Src="??Control2" %>
<table width="100%" bgcolor="#C2C2C2" cellspacing="0" cellpadding="0" runat="server">
<tr>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control1:??Control1 id="??Control1??" bgcolor="#C2C2C2" runat="server" />
</td>
</tr>
</tbody>
</table>
</td>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control2:??Control2 id="??Control2??" runat="server" />
</td>
</tr>
<tr>
</tbody>
</table>
</td>
</tr>
</table>
http://aspalliance.com/dotnetsolutions/
Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
Reply to this message...
Dennis West
What am I missing here?
Exception Details: System.IO.FileNotFoundException: C:\PortalVBVS\PortalVBVS\DesktopModules\Annoucements.ascx
Source Error:
Line 36:
Line 37: If
Page
.IsPostBack = False Then
Line 38: PlaceHolder1.Controls.Add(LoadControl("Annoucements.ascx"))
Line 39: PlaceHolder2.Controls.Add(LoadControl("Annoucements.ascx"))
Line 40: End If
Source File: C:\PortalVBVS\PortalVBVS\DesktopModules\FlexPane.ascx.vb Line: 38
Stack Trace:
----- Original Message -----
From: chris
To: aspngfreeforall
Sent: Tuesday, August 13, 2002 1:50 PM
Subject: [aspngfreeforall] RE: Not Ansered: I would like to know how to dymamically register user controls .ascx onto a parent user control
Dennis,
It is not always neccessary to Register your usercontrols at the top of your page. If you want to do it in your codebehind, I would suggest adding a Placeholder at the points in your aspx page where you would like to place your dynamic user controls. then, in your code use the
Page
.LoadControl("virtualPath") method to load them. ex:
<ex>
PlaceHolder1.Controls.Add(LoadControl("myControl.ascx"));
</ex>
hth,
-Chris Frazier
.NET Solution Developer
Velocity Databank, Inc.
www.velocitydatabank.com
-----Original Message-----
From: Dennis West [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 13, 2002 1:49 PM
To: aspngfreeforall
Subject: [aspngfreeforall] Not Ansered: I would like to know how to dymamically register user controls .ascx onto a parent user control
I would like to know how to dymamically register user controls .ascx onto a parent user control
from a dropdownlist of user controls, i would like to build a user control that would dynamically register (place) user controls within its own body. this is just an idea or what I want. It most likely is not in any way the way to do it. I just need some guidance on how to allow a user to select a control from a list and register that control onto another parent control.
<%@ Control language="vb" Inherits="Parent" CodeBehind="Parent.ascx.vb" AutoEventWireup="false" %>
<%@ Register TagPrefix="??Control1" TagName="??Control1" Src="??Control1" %>
<%@ Register TagPrefix="??Control2" TagName="??Control2" Src="??Control2" %>
<table width="100%" bgcolor="#C2C2C2" cellspacing="0" cellpadding="0" runat="server">
<tr>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control1:??Control1 id="??Control1??" bgcolor="#C2C2C2" runat="server" />
</td>
</tr>
</tbody>
</table>
</td>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control2:??Control2 id="??Control2??" runat="server" />
</td>
</tr>
<tr>
</tbody>
</table>
</td>
</tr>
</table>
http://aspalliance.com/dotnetsolutions/
Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
Reply to this message...
Tim Heuer
make sure the path is correct...it is expecting a virtual URL, so it is
expecting to find announcements.ascx in the same level/location as
flexpane.ascx
if it is, maybe it is trying to load it from the root of the site (since
the code is exectuing it)...try providing a better relative url like
LoadControl("/mysite/controls/mycontrol.ascx") or something like that
-th
______________________
Tim Heuer
-----Original Message-----
From: Dennis West [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 13, 2002 12:33 PM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: Not Ansered: I would like to know how to
dymamically register user controls .ascx onto a parent user control
What am I missing here?
Exception Details: System.IO.FileNotFoundException:
C:\PortalVBVS\PortalVBVS\DesktopModules\Annoucements.ascx
Source Error:
Line 36:
Line 37: If
Page
.IsPostBack = False Then
Line 38:
PlaceHolder1.Controls.Add(LoadControl("Annoucements.ascx"))
Line 39:
PlaceHolder2.Controls.Add(LoadControl("Annoucements.ascx"))
Line 40: End If
Source File: C:\PortalVBVS\PortalVBVS\DesktopModules\FlexPane.ascx.vb
Line: 38
Stack Trace:
----- Original Message -----
From: chris <mailto:
Click here to reveal e-mail address
>
To: aspngfreeforall <mailto:
Click here to reveal e-mail address
>
Sent: Tuesday, August 13, 2002 1:50 PM
Subject: [aspngfreeforall] RE: Not Ansered: I would like to know how to
dymamically register user controls .ascx onto a parent user control
Dennis,
It is not always neccessary to Register your usercontrols at the top of
your page. If you want to do it in your codebehind, I would suggest
adding a Placeholder at the points in your aspx page where you would
like to place your dynamic user controls. then, in your code use the
Page
.LoadControl("virtualPath") method to load them. ex:
<ex>
PlaceHolder1.Controls.Add(LoadControl("myControl.ascx"));
</ex>
hth,
-Chris Frazier
.NET Solution Developer
Velocity Databank, Inc.
www.velocitydatabank.com
-----Original Message-----
From: Dennis West [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 13, 2002 1:49 PM
To: aspngfreeforall
Subject: [aspngfreeforall] Not Ansered: I would like to know how to
dymamically register user controls .ascx onto a parent user control
I would like to know how to dymamically register user controls .ascx
onto a parent user control
from a dropdownlist of user controls, i would like to build a user
control that would dynamically register (place) user controls within its
own body. this is just an idea or what I want. It most likely is not in
any way the way to do it. I just need some guidance on how to allow a
user to select a control from a list and register that control onto
another parent control.
<%@ Control language="vb" Inherits="Parent" CodeBehind="Parent.ascx.vb"
AutoEventWireup="false" %>
<%@ Register TagPrefix="??Control1" TagName="??Control1"
Src="??Control1" %>
<%@ Register TagPrefix="??Control2" TagName="??Control2"
Src="??Control2" %>
<table width="100%" bgcolor="#C2C2C2" cellspacing="0" cellpadding="0"
runat="server">
<tr>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control1:??Control1 id="??Control1??" bgcolor="#C2C2C2"
runat="server" />
</td>
</tr>
</tbody>
</table>
</td>
<td width="50%">
<table width="100%" cellspacing="0" cellpadding="0" runat="server">
<tbody>
<tr valign="top">
<td>
<??Control2:??Control2 id="??Control2??" runat="server" />
</td>
</tr>
<tr>
</tbody>
</table>
</td>
</tr>
</table>
<%@ Register TagPrefix="Portal1" TagName="Title"
Src="~/DesktopModuleTitle.ascx"%> <%@ Control language="vb"
Inherits="ASPNetPortal.PaneDivider" CodeBehind="PaneDivider.ascx.vb"
AutoEventWireup="false" %><%@ Register TagPrefix="ActiveDataOnline"
TagName="GroupCalendar" Src="~/GC_CalendarUserControl.ascx" %>
http://aspalliance.com/dotnetsolutions/
Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT |
news://ls.asplists.com = NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
Reply to this message...
System.EventArgs
System.IO.FileNotFoundException
System.Web.UI.Page
System.Web.UI.UserControl
System.Windows.Forms.UserControl
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com