I've recently taken over development of a WinForms application using VB.NET.
A form has a RADGridView control (rgvEntities) consisting of the following Columns collection members:
- EntityName: GridViewMultiComboBoxColumn
- City: GridViewTextBoxColumn
- State: GridViewTextboxColumn
- Flag: GridViewCheckBoxColumn
- EntityID: GridViewTextBoxColumn
When the user clicks on the grid view row labelled "Click here to add a new row", the EntityName column displays a combobox for the user to choose the EntityName. When the user clicks on the drop-down arrow of the combobox, the combobox displays the following columns entityid, entityname, city, state.
My issue is that I'd like for the entityid column to not be displayed.
The RADGridView control (rgvEntities) is populated with the following code, that receives the reader as an argument:
Dim dr As DataRow
Dim strValues(5) As String
While reader.Read
strValues(0) = reader("EntityID")
strValues(1) = reader("City")
strValues(2) = reader("State")
If reader("Flag") = "Y" Then
strValues(3) = True
Else
strValues(3) = False
End If
strValues(4) = reader("EntityId")
rgvEntities.Rows.Add(strValues)
End While
I think (remember, I didn't code this initially) the entityName column is populated with the following VB.NET code in the Handles rgvEntities.UserAddedRow event handler:
Dim colEntity As Telerik.WinControls.UI.GridViewComboBoxColumn
Dim dbconn As New SqlConnection(App.My.Settings.dbConn)
Dim cmd As New SqlCommand
Dim daEntity As SqlDataAdapter
cmd.CommandType = CommandType.Text
cmd.Connection = dbconn
Dim sSql As String = ""
sSql = "select entityid, entityname, city, state from Entities "
sSql = sSql & " where Entityid > 0 order by 1"
cmd.CommandText = sSql
daEntity = New SqlDataAdapter(cmd)
ds = New DataSet()
daEntity.Fill(ds)
colEntity = rgvEntities.Columns("Entity")
colEntity.DataSource = ds.Tables(0)
colEntity.DisplayMember = "entityname"
colEntity.ValueMember = "entityid"
dbconn.Close()
colEntity = Nothing
daEntity = Nothing
dbconn = Nothing
Where rgvEntities is the RADGridView defined as:
Friend WithEvents rgvEntities As Telerik.WinControls.UI.RadGridView
Thanks in advance for any help.