Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to swap web controls? 1

Status
Not open for further replies.

mikemardon

Programmer
May 23, 2005
71
GB
Hi There

I have created a web control for navigation and another called welcome.ascx which contains the main page content.

Is it possible to swap out the welcome.ascx control with another ie. aboutus.ascx to simulate navigation?

If so, can anyone point me in the right direction please?

Thanks!
 
Yes, you can use the LoadControl method to load a specific user control


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Thanks for the info, really good to know :)

one more thing, should I use a placeholder to swap the controls into? I am thinking that this would also make the layout much easier to control??
 
I guess it really depends on what ypu want to do with this user control. If you are simply placing it into a certain section on your webpage, then it may be easier to add it to the relevant section by using the placeholder. However, if you are looking to get a reference to this control later (either from your code or from javascript) you'll have to be aware that the parent will actually be the placeholder and that the client id may not be what you are expecting.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
OK that makes a lot of sense..

I will definitely need to reference the contents of each web control (they will contain datagrids etc) so which method would you suggest from a layout viewpoint??

Thanks again for all your help so far :)
 
To be honest, it doesn't really matter as long as you are aware of where you have actually placed it and get a reference to it accordingly.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top