473,399 Members | 2,146 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,399 software developers and data experts.

Adding ASCX controls at runtime problem

I have an ASCX control with 2 objects (asp:label and asp:xml)
I wan't to add this control using Controls.Add() because my business logic
requires to select the correct control to show.

I have some code on ASCX page_load event that makes references to asp:label
(only set text property to it) and asp:xml.

If i add the control directly in an ASPX page i have no problems but if i
add it with Controls.Add() i have the following error: "Object reference not
set to an instance of an object"

What could be the solution? Should i put the logic in another event?

thanks,
Gonçalo Boléo
Nov 19 '05 #1
1 1288
As answered in your other post, source code needed.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Gonçalo Boléo" <gb****@netcabo.pt> wrote in message
news:OV**************@TK2MSFTNGP09.phx.gbl...
I have an ASCX control with 2 objects (asp:label and asp:xml)
I wan't to add this control using Controls.Add() because my business logic
requires to select the correct control to show.

I have some code on ASCX page_load event that makes references to
asp:label
(only set text property to it) and asp:xml.

If i add the control directly in an ASPX page i have no problems but if i
add it with Controls.Add() i have the following error: "Object reference
not
set to an instance of an object"

What could be the solution? Should i put the logic in another event?

thanks,
Gonçalo Boléo

Nov 19 '05 #2

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

Similar topics

2
by: JimMace | last post by:
Group, I'm somewhat new to C#, and I was wondering if anyone would know how I could add an ascx control to a Web form at runtime? Thank you in advance, Jim
4
by: MC D | last post by:
When I dynamically add a control by doing something like dim x as control = Page.LoadControl("myControl.ascx") am I actually loading the control from disk??? I don't really understand why I...
2
by: Martin | last post by:
Hi, I want to create a number of ascx controls with edit and view modes. Previously I have put two panels in the ascx - one for view (with label subcontrols), and one for edit (with text box...
0
by: Sinisa Ruzin | last post by:
Hi all, I had problem with dynamically adding/removing controls;ascx, Controls.Add(Page.LoadControl... in the same page of the IBuySpy portal. ASP.NET, C#. I added buttons to the main ASCX loaded...
4
by: rushikesh.joshi | last post by:
Hi All, I have created my own WebControl and want to add it in my aspx page at runtime. it's compiling perfectly, but when i m going to execute, it gives me error of "Object reference not set...
0
by: Jason | last post by:
I am trying to dynamically add a web user control - ctrlBlogEntry.ascx - to a page - default.aspx - (via an ASP:PlaceHolder). I was able to get it to work with the following:...
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...
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...
11
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a machine Windows Server 2003 using IIS 6.0 and I am getting the error BC30560 prjob_ascx is ambiguous in the namespace ASP I found a fix. Deleting all the files in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.