473,465 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

load one or other user control

When aspx is requested, load one user control or other based on queryString
value. How to do this? Note: only one user control to possibly appear on the
page at one time; and either of which to be loaded must appear in the same
place (in same <td>).

thank you.
Nov 18 '05 #1
4 1751
You could use the LoadControl method to load the appropriate control at
runtime.
Here's the details:
http://msdn.microsoft.com/library/de...mmatically.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Merkisson Jourhanssen" <me***@guthrie37.com> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
When aspx is requested, load one user control or other based on queryString value. How to do this? Note: only one user control to possibly appear on the page at one time; and either of which to be loaded must appear in the same
place (in same <td>).

thank you.

Nov 18 '05 #2
Use a placeholder to define where you want them to go, then add conditional code something like this

PlaceHolder1.Controls.Add(LoadControl("myFirstCont rol.ascx")

If you need the user controls to participate in viewstate, make sure you load them during PageInit (PageLoad is too late for viewstate)

Bil

----- Merkisson Jourhanssen wrote: ----

When aspx is requested, load one user control or other based on queryStrin
value. How to do this? Note: only one user control to possibly appear on th
page at one time; and either of which to be loaded must appear in the sam
place (in same <td>)

thank you

Nov 18 '05 #3
Thank you Bill.

Does PlaceHolder controls render in any way to HTML in browser, or used only
on server side to place other control?

"Bill Borg" <an*******@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com...
Use a placeholder to define where you want them to go, then add conditional code something like this:
PlaceHolder1.Controls.Add(LoadControl("myFirstCont rol.ascx"))

If you need the user controls to participate in viewstate, make sure you load them during PageInit (PageLoad is too late for viewstate).
Bill

----- Merkisson Jourhanssen wrote: -----

When aspx is requested, load one user control or other based on queryString value. How to do this? Note: only one user control to possibly appear on the page at one time; and either of which to be loaded must appear in the same place (in same <td>).

thank you.

Nov 18 '05 #4
No, it doesn't render anything, just a handy way to reserve a spot in the control tree

----- Merkisson Jourhanssen wrote: ----

Thank you Bill

Does PlaceHolder controls render in any way to HTML in browser, or used onl
on server side to place other control

"Bill Borg" <an*******@discussions.microsoft.com> wrote in messag
news:1A**********************************@microsof t.com..
Use a placeholder to define where you want them to go, then ad conditional code something like this
PlaceHolder1.Controls.Add(LoadControl("myFirstCont rol.ascx")
If you need the user controls to participate in viewstate, make sure yo load them during PageInit (PageLoad is too late for viewstate) Bil
----- Merkisson Jourhanssen wrote: ----
When aspx is requested, load one user control or other based o

queryStrin value. How to do this? Note: only one user control to possibly appea on th page at one time; and either of which to be loaded must appear in th sam place (in same <td>)
thank you

Nov 18 '05 #5

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

Similar topics

9
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
2
by: A.Wussow | last post by:
Hi Everybody, i want to load dynamically content from some user controls (with forms, or some data-controls) using atlas. So i use an UpdatePanel for loading the user control into a placeholder....
2
by: John Bailey | last post by:
I have checked around and could not find anything here that exactly matches my issue, which is odd since I have found numerous posts on this in other news groups. I have a ASP .Net 2.0 site that...
6
by: Ronald S. Cook | last post by:
We have a Windows app that has one main form (a shell, sort of). We then load user controls into a panel on the form depending on what the user has selected. Our current code to unload the...
9
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form...
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
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,...
1
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
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
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...
0
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
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 ...

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.