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

combobox without dropdown.

4 Answers 44 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Khizar Khan
Top achievements
Rank 1
Khizar Khan asked on 14 Jun 2011, 10:37 AM
Hi,

i have a datasource where there is a status column and it is a enumerator having just a status code, I have a requirement that it should show the status text in the grid, but the control should not be a dropdown, it is just a simple text field in the grid.

is this possible to implement something like a combo or lookup but not as a dropdown field?

Regards,
Khizar

4 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 15 Jun 2011, 01:30 PM
Hi Khizar,

Thank you for your question.

If I understand correctly, you have a GridViewComboBoxColumn bound to some data. You want the data to be displayed in the column cells, but you do not want it to be editable. If this is the case, I believe that setting the column ReadOnly property will cover this case. Please try this in your application and let me know whether this works for you.

I am looking forward to your reply.
 
Kind regards,
Stefan
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
0
Khizar Khan
Top achievements
Rank 1
answered on 15 Jun 2011, 02:13 PM
sorry,

I didn't put my question properly.

I want to implement something like a combobox which is binded to a datasource with displaymember and valuemember, but doesn't have a dropdown, it should be like a simple text field.

let me know if this is possible?

regards,
khizar
0
HASSAN
Top achievements
Rank 1
answered on 15 Jun 2011, 06:44 PM
I had a similar issue and i did not find a solution , i would be interested in some feedback too. 

I think what Khizar is saying is this

  • Gridview is bound to a data source , say a table in SQL database
  • Table has a column called statusCode , value ranges from 0 to 25
  • Same table or another table describe those values in simple text , statusCode_description
  • He wants to display status code value but also wants to display statuscode_description next to it , but not let the user edit that description 
  • its like a reference for status code , if user wants to change the value he does not have look elsewhere to look what a given code means , also it would be nice to have a dropdown to pick the values from
This is my understanding of the issue and it will also answer my question


Thanks for any input.

0
Stefan
Telerik team
answered on 20 Jun 2011, 03:22 PM
Hello everyone,

Thank you for writing.

@Khizar, attached you can find a sample project containing RadGridView with one GridViewComboBoxColumn. This column is bound to a DataTable with some values. I have subscribed to the CellEditorInitialized event, where I have removed the arrow button (which expands the drop down) in order to make the editor look like a text editor. Additionally, I have set the DropDownStyle to DropDown in order to allow typing in the editor. Lastly, I have set the AutoCompleteMode to SuggestAppend, to allow the user see the available options when typing. Feel free to modify the attached solution in order to fulfill your requirements. Let me know whether this works for you, or you have any additional questions.

@HASSAN, if I understand correctly, you would like to have a single column that displays two values from different columns in the data source and allow the user to modify just one of the values (having an option of a drop down). If this is the case, I would like to let you know that RadGridView does not have such a column to combine values from two sources and if you need one, you will have to implement it on your own. 

I have a suggestion which I hope you will find useful. Let the first column of RadGridView be GridViewComboBoxColumn and allow the users to change the values in there. Then, right next to it, add a GridViewTextBoxColumn with the description of those values. Make the latter one read only to disallow editing. Additionally, you can use the formatting events of RadGridView and remove the borders between these two columns, to make it look like a single column. I hope you find my suggestion convenient.
 
Regards,
Stefan
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
Khizar Khan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Khizar Khan
Top achievements
Rank 1
HASSAN
Top achievements
Rank 1
Share this question
or