473,662 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Visua lBasic

Namespace Testing
Public Class ddlCountry
Inherits DropDownList

Public Sub New()
Me.Items.Add(Ne w ListItem("Selec t a Country", "0"))
Dim Connection As New
SqlConnection(C onfigurationMan ager.Connection Strings("MainCo nnStr").Connect ionString)
Connection.Open ()
Dim command As New SqlCommand("SEL ECT CountryID, Country
FROM Countries ORDER BY Country", Connection)
Dim reader As SqlDataReader = command.Execute Reader
While reader.Read
Me.Items.Add(Ne w ListItem(reader .GetString(1),
reader.GetStrin g(0)))
End While
reader.Close()
Connection.Clos e()
End Sub
End Class
End Namespace

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

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

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

</body>
</html>

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

Feb 1 '06 #1
0 1232

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

Similar topics

2
1921
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 after utilizing this ControlDesigner, I can't parent any control to my group box in a design view(When not applying ControlDesigner everything works fine). Here's the code: internal class CGroupBoxDesigner : ControlDesigner
0
3344
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"> output.AddAttribute(HtmlTextWriterAttribute.Id, "mytable"); output.RenderBeginTag(HtmlTextWriterTag.Table); // <TR>
3
3024
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 has three HtmlTableCell objects, and each cell contains a single control added to the HtmlTableCell's Controls collection. The basic table renders correctly, but the controls within the HtmlTableCell objects do not; the cells are just empty. (Just...
3
1242
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 followed by its ID, appears in the Design view. " Instead I get only the small little green arrow. I do not get "the name of the control followed by its ID".
1
1862
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 of it I see "There was error rendering the control. Object not set to an instance of object". My control is derived from linkButton and I just needed to add a few properties but rendering stays the same. For real I just override click event and...
0
252
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 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 when I look at the control in Design(er) view of
1
1052
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 own answers except when there's 5 million possible places to look, such as in Tools -> Options. In design view it works of course, but in html view it just creates a link to my web control.
2
2373
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, (which itself derives from System.Windows.Forms.Form) Whenever I try to open on of these forms in the designer, I get an error, stating it is unable to load one or more of the requested types. (Full text at the bottom of this message)
4
9522
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 not be initialized. Details: 'False' could not be set on property 'Checked'. I have searched the web an only found one similar post where it was stated
2
5202
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' (caltext is the string I am assigning for the cssclass of a button on the control). I don't need it to display anything in design view, a blank grey box would be fine. It's just this error sometimes stop the whole page from rendering in design view. ...
0
8343
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.