R
Raphaël Désalbres
Hello, everybody,
I'm having a problem creating a control...All I want to do is a simple poll
system, so I need to input (trough a ListitemCollection) the values from the
user.
The problem is I'm getting an error each time I try to modify the elements,
I don't know why....
If anyone can help, I would appreciate...
Raphaël...
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
<DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")> Public Class WebCustomControl1
Inherits System.Web.UI.WebControls.WebControl
Dim _text As String
<Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]()
As String
Get
Return _text
End Get
Set(ByVal Value As String)
_text = Value
End Set
End Property
Public Property Itens() As ListItemCollection
Get
If Not IsNothing(viewstate("FirstTime")) Then
Return viewstate("Itens")
Else
Dim lstCol As New ListItemCollection
Dim lst As ListItem
lst = New ListItem("ASP.NET", 0)
lstCol.Add(lst)
lst = New ListItem("ASP", 0)
lstCol.Add(lst)
viewstate("FirstTime") = ""
Return lstCol
End If
End Get
Set(ByVal Value As ListItemCollection)
viewstate("Itens") = Value
End Set
End Property
Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
MyBase.Render(output)
End Sub
End Class
I'm having a problem creating a control...All I want to do is a simple poll
system, so I need to input (trough a ListitemCollection) the values from the
user.
The problem is I'm getting an error each time I try to modify the elements,
I don't know why....
If anyone can help, I would appreciate...
Raphaël...
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
<DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")> Public Class WebCustomControl1
Inherits System.Web.UI.WebControls.WebControl
Dim _text As String
<Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]()
As String
Get
Return _text
End Get
Set(ByVal Value As String)
_text = Value
End Set
End Property
Public Property Itens() As ListItemCollection
Get
If Not IsNothing(viewstate("FirstTime")) Then
Return viewstate("Itens")
Else
Dim lstCol As New ListItemCollection
Dim lst As ListItem
lst = New ListItem("ASP.NET", 0)
lstCol.Add(lst)
lst = New ListItem("ASP", 0)
lstCol.Add(lst)
viewstate("FirstTime") = ""
Return lstCol
End If
End Get
Set(ByVal Value As ListItemCollection)
viewstate("Itens") = Value
End Set
End Property
Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
MyBase.Render(output)
End Sub
End Class