load one or other user control

  • Thread starter Merkisson Jourhanssen
  • Start date
M

Merkisson Jourhanssen

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.
 
G

Guest

Use a placeholder to define where you want them to go, then add conditional code something like this

PlaceHolder1.Controls.Add(LoadControl("myFirstControl.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
 
M

Merkisson Jourhanssen

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 said:
Use a placeholder to define where you want them to go, then add
conditional code something like this:
PlaceHolder1.Controls.Add(LoadControl("myFirstControl.ascx"))

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

Guest

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 said:
Use a placeholder to define where you want them to go, then ad
conditional code something like this
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top