473,395 Members | 1,639 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 DropDownList control in ASP.NET 2.0

Hi

I've created a custom dropdown list in a web control library that my
aspx page uses as follows:

<%@ Register Assembly="CommonUI" Namespace="POLISY.Web.UI.Common"
TagPrefix="cc1" %>
....
<cc1:WFEDropDownList ID="WFEDropDownList1" runat="server">
<asp:ListItem Value="A">Apple</asp:ListItem>
<asp:ListItem Value="B">Banana</asp:ListItem>
</cc1:WFEDropDownList></td>

When I compile the .aspx I get the following error for each
<asp:ListItem> within a <cc1:WFEDropDownList> element:

Element 'ListItem' is not a known element. This can occur if there
is a compilation error in the Web site.

Any idea what's causing this? The code for WFEDropDownList is very
simple. All it does is extend DropDownList as follows:
using System.Web.UI;
using System.Web.UI.WebControls;
namespace POLISY.Web.UI.Common
{
[ToolboxData("<{0}:WFEDropDownList
runat=server></{0}:WFEDropDownList>")]
public class WFEDropDownList : DropDownList
{
// TO DO: Register javascript to display a tool tip for the
// currently selected item in the drop down. (needed in case
// of truncation)

}
}
Thanks for your help!

Mar 2 '06 #1
1 3180
DWS
Steve,
You need to implement a collection in your WWE Dropdown list to hold the
list items. http://msdn2.microsoft.com/en-us/library/9txe1d4x.aspx

Too bad cause it seems like it would work automatically inheriting from
dropdownlist.

Good Luck
DWS
"Steve" wrote:
Hi

I've created a custom dropdown list in a web control library that my
aspx page uses as follows:

<%@ Register Assembly="CommonUI" Namespace="POLISY.Web.UI.Common"
TagPrefix="cc1" %>
....
<cc1:WFEDropDownList ID="WFEDropDownList1" runat="server">
<asp:ListItem Value="A">Apple</asp:ListItem>
<asp:ListItem Value="B">Banana</asp:ListItem>
</cc1:WFEDropDownList></td>

When I compile the .aspx I get the following error for each
<asp:ListItem> within a <cc1:WFEDropDownList> element:

Element 'ListItem' is not a known element. This can occur if there
is a compilation error in the Web site.

Any idea what's causing this? The code for WFEDropDownList is very
simple. All it does is extend DropDownList as follows:
using System.Web.UI;
using System.Web.UI.WebControls;
namespace POLISY.Web.UI.Common
{
[ToolboxData("<{0}:WFEDropDownList
runat=server></{0}:WFEDropDownList>")]
public class WFEDropDownList : DropDownList
{
// TO DO: Register javascript to display a tool tip for the
// currently selected item in the drop down. (needed in case
// of truncation)

}
}
Thanks for your help!

Mar 2 '06 #2

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

Similar topics

0
by: adam | last post by:
i have custom user control and i'm trying to pass values to custom user control......I need help it seems to me i cannot pass the value to user control from dropdownlist. I have property in a...
0
by: Steve R | last post by:
I've built a composite web custom control with a lot of child controls. I assigned ToolTip values to some of these controls. The ToolTip pop-ups were working fine until I monkeyed with the order...
0
by: Joe | last post by:
I am having a hard time with setting a property on a custom server control that i am placing in a repeater. The control inherits from DropDownList. The property is being set in the repeater using...
0
by: RyanG | last post by:
when the value that determines the filter is databound?? I am trying to make a DropDownList for a set of data that I use a lot throughout my project. So I extended the DropDownList to retrieve...
7
by: Girish | last post by:
OK.. phew. Playing with data grids for the past few days has been fun and a huge learning experience.. My problem. I have a requirement to display a gird with a gird. Within the embedded grid,...
2
by: Pipo | last post by:
Nobody knows how to get the values provided in the client can be read in the user-control? If have made a Web Custom Control with 2 textboxes and 1 dropdownlist. The user fills in my control (the...
0
by: Iain | last post by:
Can I apologise for the lengthy nature of this post. The scenario is complicated (though I hope the solution is not!) basically, I've got a custom template control which binds itself to a tree...
5
by: Alan Silver | last post by:
Hello, I have a products page that takes a product ID in the query string. Based on the product details (from a database), the page then loads up one of a number of custom controls, calls a...
0
by: scott blood | last post by:
Hey all, I have tried posting this question in the relevant Asp.net newsgroups, but have unfortunatly had no reply, so hopefully someone can help me in here. I have created a custom webcontrol...
0
by: pabloazorin | last post by:
I developed a Date Picker web control using C# and .net framework 1.1 I added my control to Visual Studio 2003 IDE toolbar. When I drag and drop my control to design web page, the control renders...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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...

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.