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

Dynamically adding a web user control to a placeholder

Stu
Hi,

I have created a Web User Control (vb.net) that I want to display on a
placeholder on the page when a button is pressed. The control 'DeleteImage'
is a blank control with 2 buttons added at design time (cancel/accept).
However, if I add a reponse.write("hello world") in the page load handler
the text appears to shhow the control is actually loding & firing to some
extent, but there is no sign of the buttons!

Am I missing something really basic?

Code:
Dim ctrl As New DeleteImage
PlaceHolder1.Controls.Add(ctrl)

Thanks in advance,

Stu
Nov 19 '05 #1
1 1755
To load user controls you must use the Page.LoadControl:

dim ctrl as DeleteImage = ctype(Page.LoadControl("mycontrol.ascx"),
DeleteImage)
PlaceHolder1.Controls.Add(ctrl)

you can only use the new syntax when loading server controls.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Stu" <s.****@cergis.com> wrote in message
news:u5**************@TK2MSFTNGP14.phx.gbl...
Hi,

I have created a Web User Control (vb.net) that I want to display on a
placeholder on the page when a button is pressed. The control 'DeleteImage' is a blank control with 2 buttons added at design time (cancel/accept).
However, if I add a reponse.write("hello world") in the page load handler
the text appears to shhow the control is actually loding & firing to some
extent, but there is no sign of the buttons!

Am I missing something really basic?

Code:
Dim ctrl As New DeleteImage
PlaceHolder1.Controls.Add(ctrl)

Thanks in advance,

Stu

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
4
by: Harry | last post by:
Hello, I have a page with a RadioButtonList and a PlaceHolder control. The RadioButtonList's AutoPostBack attribute is set to TRUE and its SelectedIndexChanged event loads one of three...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
9
by: Chris | last post by:
I am dynamically adding a user control to each row in a gridview. The reason I am doing it dynamically is the user control is different depending on certain data in the gridview. The gridview...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.