Add GridViewComboBoxColumn after data load

4 posts, 0 answers
  1. John
    John avatar
    1 posts
    Member since:
    Feb 2014

    Posted 09 Apr 2019 Link to this post

    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!

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3575 posts

    Posted 11 Apr 2019 Link to this post

    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.
  3. andi
    andi avatar
    18 posts
    Member since:
    Oct 2018

    Posted 17 Apr 2019 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    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()

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3575 posts

    Posted 18 Apr 2019 Link to this post

    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.
Back to Top