473,396 Members | 1,929 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.

Rendering a derived control in design view (VS2005)

Hi

The code below compiles and works. It's a control derived from a drop
down list that displays countries for the user to select.
My issue is that is I look in the drop down list in Design view of
Visual Studio 2005 (final), rather than rendering the dropdownlist, it
renders a gray box displaying:
"Error Creating Control - ddlCountry, object reference not set to an
instance of an object."

Is this normal? Could somebody give me a pointer on how I can render
this control?
Code below.

Many thanks

Alex

---------------------------------------------------->

Imports Microsoft.VisualBasic

Namespace Testing
Public Class ddlCountry
Inherits DropDownList

Public Sub New()
Me.Items.Add(New ListItem("Select a Country", "0"))
Dim Connection As New
SqlConnection(ConfigurationManager.ConnectionStrin gs("MainConnStr").ConnectionString)
Connection.Open()
Dim command As New SqlCommand("SELECT CountryID, Country
FROM Countries ORDER BY Country", Connection)
Dim reader As SqlDataReader = command.ExecuteReader
While reader.Read
Me.Items.Add(New ListItem(reader.GetString(1),
reader.GetString(0)))
End While
reader.Close()
Connection.Close()
End Sub
End Class
End Namespace

<---------------------------------------------------->

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb"
Inherits="test" %>
<%@ Register Namespace="Testing" TagPrefix="MyControl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<Mycontrol:ddlCountry runat="server" ID="ddlCountry"/>
</form>

</body>
</html>

<----------------------------------------------------

Feb 1 '06 #1
0 1218

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

Similar topics

2
by: CroDude | last post by:
Hi all! I've made a custom group-box control derived from a GroupBox. Additionally I've made a ControlDesigner derived class associated with my group box to remove some unneeded properties. But...
0
by: threecrans | last post by:
If you create a new server control, and override the Render method with the following code: protected override void Render(HtmlTextWriter output) { // <TABLE id="mytable">...
3
by: David Whitney | last post by:
All: I have a control that renders a table. As the table is rendered, each row in the table is constructed by creating a run-time (dynamic) object that is derived from an HtmlTableRow. The row...
3
by: kurt sune | last post by:
I have quite an annoying error. I have created a web custom control. When I put it on a web page I do not get: "The control's default rendering, which is simply the name of the control...
1
by: Jarod | last post by:
Hey When I put my control into DetailsView in a template I see it and it seems as working ok. After compile it works on the page. But in normal view in designer I don't see my detailsView instead...
0
by: postings | last post by:
Hi This is (more or less) a repost from last week. Sorry I'm pretty despirate for a soltution and hope I get better luck this time! Would you mind looking at this? - Thanks.... The code below...
1
by: Steven Nagy | last post by:
As above, in VS2005 when I drag a web control I made onto my form while in code view, it creates a link instead of the web control instance. Is this configurable? Normally I try to hunt down my...
2
by: Paul Cheetham | last post by:
Hi, I have moved an application from VS2003 to VS2005, and I am now unable to view most of my forms in the designer. The majority of the forms in my project are derived from class PACForm,...
4
by: AG | last post by:
Using VS2005. When I add a server control to a page in design view, it displays the following; Error Rendering Control = <control name> An unhandled exception has occurred. 'HelpVerb' could...
2
by: Chris | last post by:
I have created a custom composite control, which is a date picker. It works fine but in the design view I get am "Error creating control" 'caltext' could not be set on property 'btnCssClass' ...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.