Good day,
please am using a radcombobox that allows for multiple selection.
My problem is how can i insert the selected items into a database one by one.
Can someone please help me
thank you
And how can I get the items from a column in a SQL Server table?
Luis
0
Doncho
Telerik team
answered on 17 Jun 2020, 04:23 PM
Hi Luis,
You can check out the different DataSources that can be used for binding data to the RadComboBox in the Data Binding Overview | RadComboBox article.
Note that the RadComboBox uses a DataSource and has no direct relation to the SQL database itself.
Here is a sample of binding a single column DataTable to the RadComboBox
VB code:
ProtectedSub Page_Load(ByVal sender AsObject, ByVal e As EventArgs) HandlesMe.Load
IfNot IsPostBack ThenDim connstring AsString = WebConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString
Dim conn As SqlConnection = New SqlConnection(connstring)
Dim myCommand As SqlDataAdapter = New SqlDataAdapter("SELECT DISTINCT [Country] FROM [Customers]", conn)
Dim dt As DataTable = New DataTable()
myCommand.Fill(dt)
RadComboBox1.DataSource = dt
RadComboBox1.DataTextField = "Country"
RadComboBox1.DataValueField = "Country"
RadComboBox1.DataBind()
EndIf
I hope this will prove helpful!
Kind regards,
Doncho
Progress Telerik
Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic. Our thoughts here at Progress are with those affected by the outbreak.