I am using a checked combobox for selecting multiple items. Following is the code am using
ASP.Net
<telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">
<telerik:RadComboBox ID="cbo_tagtofilelist" runat="server" CheckBoxes="true"
Style="width: 157px; height: 15px" ExpandDirection="Down" EnableCheckAllItemsCheckBox="true"
value="date" Skin="WebBlue">
</telerik:RadComboBox>
</telerik:RadAjaxPanel>
VB.Net
Private Sub lnkfiletag_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkfiletag.Click
ShowCheckedItems(cbo_tagtofilelist)
End Sub
Private Shared Sub ShowCheckedItems(ByVal comboBox As RadComboBox)
Dim msSQL As String = " insert into selecteditems( fileid, name ) values"
For Each chkeitems As RadComboBoxItem In comboBox.CheckedItems
If chkeitems.Checked = True Then
msSQL &= " ('" & fid & "', '" & chkeitems.Value & "'),"
End If
Next
msSQL = msSQL.Substring(0, Len(msSQL) - 1)
con.OpenConn()
con.ExecuteNonQuerySQL(msSQL)
con.CloseConn()
End Sub
But using this code I am unable to find the selected items and insert into the database. Item count always be 0
on button click, what am I doing wrong with this code
Bind your RadComboBox in Page_Init also.
Here's Code :
Please find more information here.