Link to home
Start Free TrialLog in
Avatar of r3nder
r3nderFlag for United States of America

asked on

checvk box list and for each loop

I have a check box list I want to loop through the list and get  the value of each item selected and insert each item into the database individualy does any one know how to do this

    Protected Sub ddlFIlterType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlFIlterType.SelectedIndexChanged
        If (ddlFIlterType.SelectedItem.ToString = "Department") Then
            getDepartment()
            'Response.Write("I got it to click")
        ElseIf (ddlFIlterType.SelectedItem.ToString = "City Office") Then
            getCity()
        ElseIf (ddlFIlterType.SelectedItem.ToString = "Job") Then
            getJob()
        ElseIf (ddlFIlterType.SelectedItem.ToString = "Region") Then
            getRegion()
        End If
    End Sub

Open in new window

And this is my fill for the cblValues

   Public Sub getDepartment()
        Try
            Dim ds As DataSet = Nothing
            ds = SqlHelper.ExecuteDataset(appSecurity.getConnection(), CommandType.StoredProcedure, "SP")
            Me.cblValues.DataSource = ds.Tables(0)
            Me.cblValues.DataTextField = "dept_nm"
            Me.cblValues.DataValueField = "deptid"
            Me.cblValues.DataBind()
        Catch ex As Exception
            Response.Write(ex.Message)
        End Try
    End Sub

Open in new window



Thanks
ASKER CERTIFIED SOLUTION
Avatar of binaryevo
binaryevo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of r3nder

ASKER

Thank you sir