This is a migrated thread and some comments may be shown as answers.

Add GridViewComboBoxColumn after data load

3 Answers 100 Views
GridView
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 09 Apr 2019, 05:00 PM

I would like to be able to load data into the grid and then add the GridViewComboBoxColumn to an existing column and have the column display the display member for all rows of existing data. We load many different sets of data into one grid and want to use auto generate as it takes care of most of the database fields. This would leave having to only assign the drop down fields.

We do not want to manually define each set of columns for every set of data as we have hundreds of queries we use. This is something I am able to do with other vendor's products and need to be able to do with Telerik's grid.

Thanks!

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Apr 2019, 02:26 PM
Hello, John,    

Your question has already been answered in the support thread you have opened on the same topic. However, I am posting the answer here as well in order the community to benefit from it. You can leave RadGridView to automatically generate the columns. Then, remove the column that you want to have a drop down and add a GridViewComboBoxColumn specifying the FieldName property to the respective field from the DataSource that you want ti display in the column. The following help article demonstrates how to add and setup the GridViewComboBoxColumn: https://docs.telerik.com/devtools/winforms/controls/gridview/columns/column-types/gridviewcomboboxcolumn

I have also prepared a sample project for your reference which result is illustrated in the below screenshot:



We kindly ask you to use just one thread for a specific problem to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two or more tickets instead of one. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.

Thank you for your understanding.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
andi
Top achievements
Rank 1
answered on 18 Apr 2019, 02:20 AM

Hii des,

But it will replace what we have loaded before, how to make data loaded still exist while comboboxcolumn added.

Thanks in advance

this isi the code :

         Call SQLServerConn()

        Cmd = New SqlCommand("SelectVRA_D", Conn)
        Cmd.CommandType = CommandType.StoredProcedure
        Cmd.Parameters.Add("@NoObj", SqlDbType.Char, 3)
        Cmd.Parameters("@NoObj").Value = "13"
        Cmd.Parameters.Add("@Year", SqlDbType.Char, 4)
        Cmd.Parameters("@Year").Value = "2019"
        Cmd.Parameters.Add("@Est", SqlDbType.Char, 4)
        Cmd.Parameters("@Est").Value = "WS"
        Cmd.Parameters.Add("@Comp", SqlDbType.Char, 3)
        Cmd.Parameters("@Comp").Value = "900"

        daVRAD = New SqlDataAdapter(Cmd)
        dsVRA = New DataSet("VRA")

        daVRAD.Fill(dsVRA, "VRA_D")
        RadGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None
        RadGridView1.DataSource = dsVRA.Tables("VRA_D")

        Me.RadGridView1.Columns.Remove("Code")

        Call KoneksiSQLServer()
        Cmd = New SqlCommand("SelectPrice", Conn)
        Cmd.CommandType = CommandType.StoredProcedure
        Cmd.Parameters.Add("@Year", SqlDbType.Char, 4)
        Cmd.Parameters("@Year").Value = "2019"
        Adapter = New SqlDataAdapter(Cmd)
        table = New DataTable
        Adapter.Fill(Dt)
        Adapter.Dispose()
        Dim codecb As GridViewMultiComboBoxColumn = New GridViewMultiComboBoxColumn
        codecb.DataSource = Dt
        codecb.Name = "code"
        codecb.HeaderText = "Kode"
        codecb.DisplayMember = "Name"
        codecb.ValueMember = "code"
        codecb.DropDownStyle = RadDropDownStyle.DropDown
        codecb.AutoCompleteMode = AutoCompleteMode.Suggest
        codecb.FieldName = "code"
        codecb.Width = 120

        Me.RadGridView1.Columns.Insert(2, code)
        Me.RadGridView1.BestFitColumns()

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Apr 2019, 10:48 AM
Hello, Andi,    

It seems that the automatically generated column is removed and a GridViewMultiComboBoxColumn is added associated with the respective FieldName. According to the provided information, it is not clear enough what is the exact setup that you have in the whole grid and what exactly is replaced which was loaded before.

I would kindly ask you to open a separate support thread with the appropriate Product (RadGridView for WinForms) from your Telerik account and provide a sample runnable project demonstrating the undesired result that you are facing. Thus, our support staff will gladly assist you.

Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket. Thank you for your understanding.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
John
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
andi
Top achievements
Rank 1
Share this question
or