Test Menu

  • Commentary
  • Deals
  • Coupons

Nov 22, 2011

Databound Checklist - Check All by Default


The following code shows an easy way to loop through the list of checkboxes and select each one:


''' <summary>
''' checks all of the checkboxes by default
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Protected Sub chkListParameterSelections_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkListParameterSelections.DataBound


        Try


            For Each li As ListItem In chkListParameterSelections.Items
                li.Selected = True
            Next


        Catch ex As Exception
            ErrorLogging.LogError(ex, "ctrlStatistics.chkListParameters_DataBound")
        End Try


End Sub

No comments:

Post a Comment