Problem creating web control...

  • Thread starter Raphaël Désalbres
  • Start date
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top