I have 10 columns in datagridview out of which last 3 columns(caste,prof,degree) are combobox. My task is if database have value for these 3 fields,it should display in combobox of grid else empty combobox should be added for user to select value.Code to add combobox column is below.Can any1 please help me.
Dim con As OdbcConnection = New OdbcConnection
sql = "Select Description from Category where Catgry = 1"
con.ConnectionString = connstring
If con.State = ConnectionState.Open Then con.Close()
Dim da As OdbcDataAdapter = New OdbcDataAdapter(sql, con)
.Name = "Caste"
.HeaderText = "Caste"
.DataSource = ds.Tables("Caste")
.DisplayMember = "Description"
.ReadOnly = False
30 Dec '12 - 19:53
Edited 30 Dec '12 - 19:54
Add in a item template in your gridview.
Once that is done you would get options to link them to sql datasources or other sources to get the records.
Pass in a sql select command. if it doesnt return anything, then the combobox would be empty
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)