Grid View ComboBox Column

14 posts, 0 answers
  1. Barry
    Barry avatar
    13 posts
    Member since:
    May 2009

    Posted 27 May 2009 Link to this post

    Hi,

    I have the following:

    A Grid View populated by DataSet_A (Columns are Username, Exec_Code, Exec_Name)
    Within the Grid View a Combo box column which is populated by DataSet_B (Exec_Code, Exec_Name)  Exec_Code would be a ValueMember and Exec_name would be the DisplayMember

    However, the value displayed in the Combo box should be the same value as the Exec_Name from DataSet_A.  When the combo box value is changed the Exec_Code value & Exec_Name value in DataSet_A should be updated.

    How can I do this?

    Thanks

    Barry
  2. Barry
    Barry avatar
    13 posts
    Member since:
    May 2009

    Posted 29 May 2009 Link to this post

    Hi,

    Don't worry I figured this out

    Thanks

    Barry
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Nick
    Admin
    Nick avatar
    767 posts

    Posted 29 May 2009 Link to this post

    Hello Barry,

    Thank you for contacting us. I am glad that you found a solution for your project.

    Sincerely yours,
    Nick
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Imran Khan
    Imran Khan avatar
    3 posts
    Member since:
    May 2010

    Posted 07 Sep 2011 Link to this post

    hi ,
    i have the same problem can you plz tell me the solutions
  6. Alexander
    Admin
    Alexander avatar
    306 posts

    Posted 08 Sep 2011 Link to this post

    Hello Imran,

    You can set the FieldName property of GridViewComboBoxColumn to the column of RadGridView's DataSource which the GridViewComboBoxColumn refers to. In the Barry's example it is Exec_Code.

    The following help article provides additional information regarding the usage of GridViewComboBoxColumn. Please let me know if you have additional questions.

    Best regards,
    Alexander
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  7. Imran Khan
    Imran Khan avatar
    3 posts
    Member since:
    May 2010

    Posted 08 Sep 2011 Link to this post

    hi,
    thanks for your response.

    can you please elaborate the difference b/w of FieldName and ValueMamber property of RadComboBox Column

    Thanks.
  8. Alexander
    Admin
    Alexander avatar
    306 posts

    Posted 13 Sep 2011 Link to this post

    Hello Imran,

    Thank you for writing back.

    ValueMember is the name of the column from the GridViewComboBoxColumn's DataSource which identifies the values in the dropdown of the GridViewComboBoxColumn. For example, if the DataSource of the column is a table 'Car' which contains two columns - 'ID' and 'Brand', you can use 'ID' as ValueMember.

    FieldName is the name of the column from the RadGridView DataSource which the GridViewComboBoxColumn is bound to. In the above example, if you bind the RadGridView control to a table 'Driver' which has a FK column 'CarID', you can set 'CarID' as FieldName. When you change the value in the GridViewComboBoxColumn, the DataSource of RadGridView will update with the newly selected car for this driver.

    I hope it makes the using of ValueMember and FieldName more understandable.

    Best regards,
    Alexander
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  9. Don
    Don avatar
    60 posts
    Member since:
    Aug 2010

    Posted 06 Oct 2011 Link to this post

    I have a slightly different scenario. I have a grid with one datasource and a combobox column within that grid that has a different datasource. There is a value in the grid's datasource which corresponds to a value in the grid's datasource. I would like to use that corresponding value to set the value in the combobox's datasource. This will give me the displayvalue in the combobox that I wish the user to see. The idea is to let the user change the displayvalue in the combobox and then persist that change back to the database by saving the corresponding record in the grid's datasource.

    I can get the column that is to contain the combobox to show in the grid, but it shows as a textbox. I know I'm missing something and that it is probably a simple something, but I can't figure out just what that something is. Any help would be appreciated!
  10. Alexander
    Admin
    Alexander avatar
    306 posts

    Posted 11 Oct 2011 Link to this post

    Hello Don,

    Thank you for your question.

    This KB article demonstrates how to create a RadDropDownListEditor with DataSource which depends on the value of another RadGridView cell. Please let me know if it helps you to achieve your requirements.

    Best regards,
    Alexander
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

  11. Don
    Don avatar
    60 posts
    Member since:
    Aug 2010

    Posted 24 Oct 2011 Link to this post

    It kind of helps, but not really. I'm getting the right information to show in my combobox column, but the column is not showing as a combobox. It probably has something to do with setting the active editor, but there isn't a whole lot of documentation on that aimed at someone who has never included a combobox in a grid before using the Telerik controls.
  12. Don
    Don avatar
    60 posts
    Member since:
    Aug 2010

    Posted 24 Oct 2011 Link to this post

    What I need to see is a simple set of steps for attaching a RadDropDownListEditor to a GridViewComboBox including all of the events requiring code to initialize things. The sample from your documentation has some of the required events, but not all of them.
  13. Alexander
    Admin
    Alexander avatar
    306 posts

    Posted 27 Oct 2011 Link to this post

    Hello Don,

    Thank you for writing back.

    The Editors section of the RadGridView documentation includes articles for customizing editors, handling editors’ events, creating custom editors and others. If this documentation is not sufficient for implementing your scenario, please open a new support ticket, attach your project and describe your requirements. It will help us provide you with more specified support.

    Best regards,
    Alexander
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

  14. Laura
    Laura avatar
    3 posts
    Member since:
    May 2016

    Posted 15 Aug in reply to Alexander Link to this post

    The link to this article is not working, please advise, as I would like to do this in my code.
  15. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 16 Aug Link to this post

    Hello Laura,

    Thank you for writing. 

    The following KB article demonstrates how you can implement the popular 'cascading combos' scenario where the range of options available in a drop-down list of a combo column depends on the choice made by the end-user in another combo column for the same row:  http://www.telerik.com/support/kb/winforms/gridview/details/cascading-comboboxes-in-radgridview

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready