In a grid I have a checkboxlist. I can retrieve the selectedvalue, but, in order to insert/update/delete the selectedvalue in a datatable, I would like to retrieve which item of a checkboxlist has been checked or unchecked. I think it's a tiny issue, but I keep struggling with it, despite my search on the forum and the internet.
| Protected Sub chkTasks_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) | |
| Dim Today As Date | |
| Today = Now() | |
| Dim chkBox As CheckBoxList = CType(sender, CheckBoxList) | |
| Dim myPanel As Panel = CType(chkBox.Parent, Panel) | |
| Dim dataItem As GridDataItem = CType(myPanel.NamingContainer, GridDataItem) | |
| If chkBox.SelectedValue <> "" Then | |
| dataItem("FileName").Style("color") = "orange" | |
| Dim file As Integer = dataItem("FileId").Text | |
| Dim Task As Integer = chkBox.SelectedValue | |
| Dim Ext As RadComboBox = TryCast(dataItem.FindControl("cmbxExtension"), RadComboBox) | |
| Dim Extension As Integer = Int32.Parse(Ext.SelectedValue) | |
| Dim strSQL As String = _ | |
| "INSERT INTO tblBewerkingToFile " & _ | |
| "(FileId, BewerkingId, ExtensionFormat) " & _ | |
| "VALUES " & _ | |
| "(@FileId, @BewerkingId, @ExtensionFormat)" | |
| Dim Command As New SqlCommand(strSQL) | |
| Command.Parameters.AddWithValue("@FileId", file) | |
| Command.Parameters.AddWithValue("@BewerkingId", Task) | |
| Command.Parameters.AddWithValue("@ExtensionFormat", Extension) | |
| DBPortal.Execute(Command) | |
| End If | |
| Dim previewControl As Control = FindPageControl("previewControl") | |
| Dim NoResults As Label = previewControl.FindControl("lblNoChoice") | |
| NoResults.Visible = False | |
| Dim ValidResults As Repeater = previewControl.FindControl("rpValidBewerking") | |
| ValidResults.Visible = True | |
| End Sub | |