473,395 Members | 1,790 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.

Custom Control rendering in designer with object reference error

yarbrough40
320 100+
hey gang, I created a custom server control. The control works perfectly when added into a project. The issue I have though, is that in the designer - it shows the error --> "Error creating control - MyControl1 Object Reference not set to an instance of an object"
The error is because I am using this code to load startup scripts
Expand|Select|Wrap|Line Numbers
  1. Dim pg As Page = HttpContext.Current.Handler
if i comment it out then the designer does not throw the object reference error so I know this is where the problem is. So here is my question: How can I get the designer to ignore the HttpContext.Current.Handler object for rendering puroposes?
Jan 2 '11 #1

✓ answered by yarbrough40

Hey there! yes I finally did. The error went away when I added a
Expand|Select|Wrap|Line Numbers
  1. If Not HttpContext.Current Is Nothing 
Simple as that : )
thanks for checking in

2 2608
CroCrew
564 Expert 512MB
Hey Yar,

Did you find an answer to your question?

CroCrew~
Jan 18 '11 #2
yarbrough40
320 100+
Hey there! yes I finally did. The error went away when I added a
Expand|Select|Wrap|Line Numbers
  1. If Not HttpContext.Current Is Nothing 
Simple as that : )
thanks for checking in
Jan 19 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Punisher | last post by:
I have a method that does this: General_DataGrid gdgCurrentItem = new General_DataGrid(); Page.Controls.Add(gdgCurrentItem); Now General_DataGrid is a usercontrol that's just a datagrid. It's...
1
by: Martine | last post by:
Hi there! I have a problem with programmatically adding user controls to my mobile webforms. If I load my usercontrol programmatically (in the Page_Load), the object is instantiated, I have...
2
by: Jeff | last post by:
I'm getting an Object Reference error before I even run my app, and I'm not sure where to look to find the cause. I'd appreciate your help. When I open my Windows Application project, the...
9
by: Remulac | last post by:
Hello, I'm trying to get the value out of a dropdown list box and assign it to a variable. When I click on the list box, I invoke this line of code. I get the error, "Object reference not set...
7
by: Brett | last post by:
I'm not sure why I keep getting this error, "Object reference not set to an instance of an object". Private Function somefunction() as string Dim MyCurrentClass As New Class1 Try For i As...
2
by: tjonsek | last post by:
I've been reading most of the day on how to use datagrids and came up with code to delete a record. I'm getting an error "Object Reference not set to an instance of an object" for the line where I...
1
by: craig.melbourne | last post by:
I'm getting a strange bug with my of my applications When I build and run the app on my develpment machine all works fine. Once I move it to another machine I get a typical Object Reference...
2
by: danielle.m.manning | last post by:
I have a question about a problem I am having with attempting to port some old ASP code to ASP.NET. We have a dll out there which we downloaded which creates GUIDs for session management. In...
1
by: Nathan Sokalski | last post by:
I have a UserControl that I declare programmatically as follows: Dim userctrl as New rightside_portal() The codebehind file for this UserControl looks like the following: Partial Public...
1
by: prithvis.mohanty | last post by:
using System; using System.Drawing; using System.ComponentModel; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Text; using System.Collections; using...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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.