' Collection of code snippets by Arne Vajhøj 
' (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
Imports System
Imports System.Collections.Generic
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace Demo
    Public Class Test
        Inherits Page
        ' components
        Protected Data1 As ListView
        Protected Data2 As Repeater
        Protected F1 As TextBox
        Protected F2 As TextBox
        Protected F3 As DropDownList
        Protected Save As Button
        ' bind all data for show
        Private Sub BindShowData()
            Data1.DataSource = DB.GetAll()
            Data1.DataBind()
            Data2.DataSource = DB.GetAll()
            Data2.DataBind()
        End Sub
        ' setup page
        Public Sub Page_Load(src As [Object], e As EventArgs)
            If Not IsPostBack Then
                F3.DataSource = New String() {"", T1.VER, T1.NOTVER}
                F3.DataBind()
            End If
            BindShowData()
        End Sub
        ' form submit
        Public Sub Save_Click(sender As Object, e As EventArgs)
            DB.SaveOne(New T1() With { _
                .F1 = Integer.Parse(F1.Text), _
                .F2 = F2.Text, _
                .F3 = F3.Text _
            })
            BindShowData()
        End Sub
    End Class
End Namespace
