Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / October 2006

Tip: Looking for answers? Try searching our database.

Loading a user control during runtime

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ukeu - 05 Oct 2006 14:36 GMT
Hi All,

I wish to load some user controls on a web page dynamically.

I could use the LoadControl method, but there is a catch - the user
control needs to be dynamically built and then loaded at runtime. The
controls will not part of the initial project so they won't be
pre-compiled.

Is this possible in C#.NET + ASP.NET 1.1?

Thanks in advance. :)
Teemu Keiski - 05 Oct 2006 20:00 GMT
Hi,

perhaps Page.ParseControl is what you are looking for?

For example

Control c = ParseControl("<asp:button text='Click here!' runat='server'
/>");
myPlaceholder.Controls.Add(c);

E.g you can parse control from the markup

Signature

Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

> Hi All,
>
[quoted text clipped - 8 lines]
>
> Thanks in advance. :)
ukeu - 06 Oct 2006 06:53 GMT
Hi,

Thanks! This works just fine.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.