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

Reference a control in a placeholder control

How do I get the page to respond to events on a dynamically loaded user
control in a placholder control?
I am trying to reference the control in the placeholder from my codebehind
for the page

On the calling page I have:
Protected WithEvents PH As System.Web.UI.WebControls.PlaceHolder

Protected WithEvents phMain As System.Web.UI.WebControls.PlaceHolder

Protected WithEvents btnCompanies As Button =
CType(Page.Controls("PH").Controls("btnCompanies") , Button)

Public Sub myCompBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCompanies.Click

phMain.Controls.Add(LoadControl("myctls\companies. ascx"))

End Sub

_________________

I get a "Input string was not in a correct format" error on the line where I
try to dimension the button. Any ideas how to correct the problem? Thanks
to everyone
Nov 19 '05 #1
0 996

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

Similar topics

0
by: Steven | last post by:
From a fairly good understanding of traditional ASP I am taking my first tentative steps into C#. Within Visual Studio, my first test is as follows: Default.aspx contains a placeholder...
1
by: Kris van der Mast | last post by:
Hi, been a while since I posted a question myself instead of trying to help others out. I'm refactoring an existing web app that uses dynamic loading of user controls and a lot of...
4
by: Joo Park | last post by:
Hello, I'm trying to add a TextBox to a web page dynamically. However, the compiler is complaining that it needs to be place in a form. How do I get a reference to a form object so that i can...
6
by: blash | last post by:
Can someone help me? I really don't have a clue. My company staff told me they often got such error: "Object reference not set to an instance of an object." when they are in search result page...
2
by: Chris Kettenbach | last post by:
Good Morning, I have a user control I dynamically load in the page_init event into a asp:placeholder control. This page also has another placeholder I would like to dynamically load controls into...
7
by: Samuel | last post by:
Hi, I am building a page that makes use of user control as a templating technique. The following is that I have in mind and it is actually working: Root/ -- login.aspx -- login.aspx.vb --...
3
by: John Hughes | last post by:
I'm trying to add a user control to a form via the pages render method and I get the following error : "Control 'Button1' of type 'Button' must be placed inside a form tag with runat=server" ...
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
2
by: Andy B | last post by:
I have the following listView control on a page: <asp:ListView ID="ListView1" runat="server" ItemPlaceholderID="PlaceHolder1"> <ItemTemplate> <dl> <dt>
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.