473,320 Members | 1,945 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,320 software developers and data experts.

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 1748
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.