Property. Control or View State?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hello,

I am creating a control which I will compile in a class.
I am having problems when I use a property in the View State:

' Items
<Bindable(True), Category("Data"), DefaultValue(""),
Localizable(True)> _
Property Items() As Generic.List(Of String)
Get
If ViewState("Items") Is Nothing Then
Return New Generic.List(Of String)
Else
Return ViewState("Items")
End If
End Get
Set(ByVal Value As Generic.List(Of String))
ViewState("Items") = Value
End Set
End Property ' Items

But I don't get problems if I use it in Control State:

Private _Items As New Generic.List(Of String)
Public Property Items() As Generic.List(Of String)
Get
Return _Items
End Get
Set(ByVal value As Generic.List(Of String))
_Items = value
End Set
End Property ' Items

Anyway, this is a little bit confusing to me.
Could someone tell me which one should I use?
I am working on ASP.NET 2.0.

Thanks,
Miguel

.



Relevant Pages

  • Re: CreateEventProc error
    ... Private Sub BuildDisplayForm(strPath As String, ... Dim qdf As QueryDef, qdfControls As QueryDef ... Dim ctl As Control, ctlLabel As Control, ctlParent As Control ... Dim strFilter As String, strSuffix As String, strParentName As String, ...
    (microsoft.public.access.forms)
  • Re: unable to load WinSocket dll in Excel Visual Basic Editor
    ... in my "com controls" list but as soon as I try to add the winsock control I ... may or not need the alias portion of the library definiation. ... Public Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias ... (ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, ...
    (microsoft.public.excel.programming)
  • Having trouble with multi-select list box in Access
    ... Const mstrcRange_Begin As String ... name of a control that represents the End part of a range ... On Error GoTo ErrHandler ...
    (microsoft.public.access.gettingstarted)
  • Re: All Menu Navigation
    ... i based the implementation on sample code from http://www.asp.net/CSSAdapters/Menu.aspx, which shows how to create decent HTML for a Menu control bound to a SiteMapDataSource. ... public void RenderBeginTag(HtmlTextWriter writer, string cssClass) ... static public void RemoveProblemTypes ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: DataGrid not showing programmatic changes
    ... There's another data grid control that will connect, ... DAO then select the DBGrid32.ocx. ... > Public Property Let Connection(ByVal sConn As String) ...
    (microsoft.public.vb.general.discussion)