Imports MonoSoftware.Web.ListView Public Class ListViewExample1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Protected WithEvents chkBoxes As System.Web.UI.WebControls.CheckBox Protected WithEvents lvView As System.Web.UI.WebControls.RadioButtonList Protected WithEvents lvItemType As System.Web.UI.WebControls.RadioButtonList Protected WithEvents ListView1 As MonoSoftware.Web.ListView.ListView Protected WithEvents commandLabel As System.Web.UI.WebControls.Label Protected WithEvents getCheckedButton As System.Web.UI.WebControls.Button Protected WithEvents checkedLabel As System.Web.UI.WebControls.Label Protected WithEvents checkedItemsCell As System.Web.UI.HtmlControls.HtmlTableCell 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ListView1.ItemsViewState = False ListView1.View = CType(System.Enum.Parse(GetType(View), lvView.SelectedValue), View) ListView1.CheckBoxes = chkBoxes.Checked checkedItemsCell.Visible = ListView1.CheckBoxes SetItemType() ListView1.DataBind() 're-set commandLabel.Visible = False End Sub 'Page_Load Private Sub SetItemType() Dim iType As ItemType = CType(System.Enum.Parse(GetType(ItemType), lvItemType.SelectedValue), ItemType) If iType = ItemType.LinkButton Then commandLabel.Text = "Clicking an Item's 'title' will raise a server-event..." commandLabel.Visible = True Else commandLabel.Visible = False End If If iType = ItemType.HyperLink Then Return End If For Each lvItem As ListViewItem In ListView1.Items lvItem.ItemType = iType Next End Sub 'SetItemType Private Sub getCheckedButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles getCheckedButton.Click Dim selectedItems As String = "Selected (checked) items:<br>" For Each selItem As ListViewItem In ListView1.CheckedItems selectedItems += selItem.Text + "<br>" Next checkedLabel.Text = selectedItems End Sub 'getCheckedButton_Click Private Sub ListView1_ItemCommand(ByVal sender As Object, ByVal e As MonoSoftware.Web.ListView.ListViewCommandEventArgs) Handles ListView1.ItemCommand commandLabel.Text = "Cliked on an item <b>" + e.Item.Text + "</b> with version (hidden column): <b>" + e.Item.SubItems(1).Text + "</b>" commandLabel.Visible = True End Sub 'ListView1_ItemCommand End Class