Creating Dynamic User Controls

Having known how to create a user control, you should also know how to add it to the web page where it is required. If the page in which the user control is added is not known and you have to dynamically add the user control to the page then you have to use some other method to do it.

To load a user control to the page, you have to use the LoadControl method in the Page_Load event. The LoadControl event takes the name of the user control as its argument and then loads the user control to the page.

Then you can easily add it to the controls collection using the Controls.Add method. However with this you may not know where this user control will be positioned. So you need a placeholder or something like a panel control where you are add the user control.

For example to add the user control dynamically to the placeholder, you can use the following command syntax,

PlaceHolder_Ctrl.Controls.Add(name_of_UserControl);

There are many samples available in the internet on how to add the user control dynamically to the web page.


Application Development Software offers IBM i, .NET support.
Accelerator(TM) for .NET v3.2 provides Developer Solutions, with support for IBM i as well as framework that generates SOA-compliant applications without proprietary lock-ins. Additional features include Mobile Signature Capture application, Attachment Manager, data grid capabilities, and search filtering. Also included, Accelerator Multi Level TreeGrid combines standard Tree and Grid controls ...

Equinix Announces SSAE 16 Standards Compliance for 39 Data Centers in North America
Equinix, Inc. , a provider of global data center services, today announced that 39 of its North American data centers have achieved Statement on Standards for Attestation Engagements No.

Parental Controls for Amazon Kindle Fire Available From Mobicip
Mobicip is now offering Internet content filtering specifically for Kindle Fire to shield kids from inappropriate contentThousand Oaks, CA (PRWEB) January 11, 2012 As devices like Kindle Fire grow in popularity, parents' concern about what their children are viewing online is growing as well. Mobicip, the leading Internet content filtering and parental controls service for iPhone, iPod Touch ...




______________________________________________________

Recommended Resource



| Converting Web Pages to User Controls in .NET | .Working on .NET User Controls | Overview of ASP.NET User Controls | Web User Controls - Creation and Implementation | Advantages of using User Controls in ASP.NET | Re-usability of User Controls in ASP.NET | Personalizing Web Application by Creating User Controls in .NET | Customizing your Application with VB.net User Controls | Building User Controls in ASP.NET | Examples of User Controls in VB.NET | Example of C# User Controls | Where to use Visual Basic User Controls | Working on User Interface Controls | Creating Dynamic User Controls | Understanding VB .NET User Controls | Creating User Controls VB.NET | How to load user controls dynamically |



_______________

FREE Subscription

Stay Current With the Latest Technology Developments Realted to .NET. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.


 

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |