I am getting an error stating that ListItem is not a known element when I add <asp:ListItem .../> to my extended DropDownList control. The page works fine when I run it, but I have an error for each ListItem in design mode.
The following is how the control appears on the page:
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
<DefaultProperty("Text"), ToolboxData("<{0}:TrackDropDownList runat=server></{0}:TrackDropDownList>")> _
Public Class TrackDropDownList
Inherits DropDownList
<Bindable(True), Category("Appearance"), DefaultValue(""), Localizable(True)> Property CurrentValue() As String
Get
Return MyBase.SelectedValue
End Get
Set(ByVal Value As String)
MyBase.SelectedValue = Value
End Set
End Property
<Bindable(True), Category("Appearance"), DefaultValue(""), Localizable(True)> Property LastValue() As String
Get
Dim s As String = CStr(ViewState("LastSelectedValue"))
If s Is Nothing Then
Return String.Empty
Else
Return s
End If
End Get
Set(ByVal Value As String)
ViewState("LastSelectedValue") = Value
End Set
End Property
<Bindable(True), Category("Appearance"), DefaultValue(""), Localizable(True)> Property FieldName() As String
Get
Dim s As String = CStr(ViewState("FieldName"))
If s Is Nothing Then
Return String.Empty
Else
Return s
End If
End Get
Set(ByVal Value As String)
ViewState("FieldName") = Value
End Set
End Property
Public Sub setValues(ByVal Value As String)
CurrentValue = Value
LastValue = Value
End Sub
Public Function IsChanged() As Boolean
Return Not (LastValue = CurrentValue)
End Function
End Class
Philotech
Participant
1130 Points
227 Posts
asp:listitem not recognized in extended dropdownlist control
Jun 07, 2006 07:42 PM|LINK
I am getting an error stating that ListItem is not a known element when I add <asp:ListItem .../> to my extended DropDownList control. The page works fine when I run it, but I have an error for each ListItem in design mode.
The following is how the control appears on the page:
<cc1:TrackDropDownList FieldName="sdfsdfsf" LastValue=<%# Eval("ICORenewal") %> CurrentValue=<%# Bind("ICORenewal") %> runat="Server" ID="test"> <asp:ListItem Text="" Value="" /> <asp:ListItem Text="Yes" Value="Yes" /> <asp:ListItem Text="No" Value="No" /> <asp:ListItem Text="Not Sure" Value="Not Sure" /> </cc1:TrackDropDownList>The following is the code for the extended class:
Thanks in Advance,
Jason