I have a datagrid from devexpress in a winform application.I populated the datagrid from code (datasource=my datatable with 2 strings columns and one of type int (receive 0 and 1 values-should be checkbox on form).
I added a datagrid and from designer I added 3 columns.The last one of type checkbox.I set
UnboundType=Integer,
UnboundExpression=my column name from datatable :
DisplayFormat = Numeric,
columnedit = checkbox,
Displaycheckedvalue = 1,
displayuncheckedvalue = 0.
When I run the application always my checkboxes are blue.If i press one checkbox appear a check but when i go to the next row the previous value is again blue.What should i do so why the application keep the checks?
Don't set the column to be unbound, it is in your datasource after all.
What you want to do is just to set Displaycheckedvalue and displayuncheckedvalue as you have done, nothing more.
You can make a class which got a property for each column of your table. The int value would be a bool and so you can use List as datasource. The Grid will automaticly add checkboxes for the bool value.
If you want to use DataTable see Stig's post but in my opinion it is more beautiful to use classes and List.
Related
I am working with Syncfusion tools, and am trying to add a ComboBoxAutoComplete control to a Windows form. I have a DataTable that I'm using as my DataSource with two columns: ID and Name. I set the DataSource, DisplayMember, and ValueMember properties like so:
ComboBox1.AutoCompleteControl.DataSource = table
ComboBox1.DisplayMember = "Name"
ComboBox1.ValueMember = "ID"
The control loads correctly, but it appears that the DisplayMember does not get applied. The control will display only the ID of the selected item. When I expand the drop-down, it displays the entire table (both columns). I tried setting the DisplayMember and ValueMember directly on the AutoCompleteControl, but those properties do not exist. Is there a different property that is used to control what text is displayed in the ComboBoxAutoComplete control?
We have prepared the simple sample in which we have assigned data table to "DataSource" property of AutoCompleteControl inside the ComboBoxAutoComplete to enable the AutoComplete features.
To display the value based on DisplayMember assigned the Data table columns to “Columns” (collection property) of AutoCompleteControl and set “MatchingColumn” value as True for which column has been set in DisplayMember.
Please check with the sample from below location.
Sample: ComboBoxAutoComplete_Sample
Regards,
Keerthana J
Greeting,
I have problem about Dev Express in VB.NET 2005.
Im using Data Grid View.
How to use Data grid with checkbox in each row like this picture below ?
I can not find that properties.
This is regular List View in VB.NET
http://i293.photobucket.com/albums/mm54/davisvee/Snap1_zps07f5a11a.jpg
Thanks for reading and answer
I think here you can see an example how to do this implement multi row selection: or here
use unbound checkbox column
Hope it helps. Just skip the part with selection
You have to bind your field of the dev express grid with the column of the data table your gridview is bound to and make sure that the case of both datatable filed and gridcolumn. Fieldname is same. After doing this thing, you need to add the following code snippet to make
RepositoryItemCheckEdit repositoryCheckEdit1 = gridControl1.RepositoryItems.Add("CheckEdit") as RepositoryItemCheckEdit;
repositoryCheckEdit1.ValueChecked = "True";
repositoryCheckEdit1.ValueUnchecked = "False";
gridView1.Columns["Item"].ColumnEdit = repositoryCheckEdit1;
The above example is true for the fields which has true or false as saved values in database.
If you just want the selection mode as CheckBoxes, then try this in the Designer:
Then you can get the selected row's values as you wish.
Use RepositoryItemCheckEdit from repository section, set values check as 1 and uncheckvalues as 0
and set repository to column edit
I have a DataGrid bounded to OservableCollection populated cols and rows dynamically. The DataGrid's row has couple of buttons. On each button a method is called (have implemented AddHandler while generating columns).
In the handler method, I can get which row was selected. I want to know the button of which column was selected. Based on that only I can take action and open respective windows.
How do I know which button of the row was selected ?
I get the column using :
int col = myDataGrid.CurrentCell.Column.DisplayIndex;
int row = seivesTorGrid.SelectedIndex;
Based on this I am able to code respective actions.
I am having a Datagrid that gets populated with values from a DataTable. In my program i have four buttons: Goto First, Last, Next and Previous, as the name name indicates i have to select the rows based on the selection made using these buttons. Everything seems well if i use the below code to get the row (for example first row).
DataGridRow row =(DataGridRow)userControl.m_DataGrid.ItemContainerGenerator.ContainerFromIndex(0);
row.IsSelected = true;
But the code throws null value when there is more rows than the height of the Datagrid(When scrollbar comes into picture).
Please help me out of this issue. I think this is because of the view problem.
Due to virtualization the containers are only created when the object is in view, so you could first scroll the item into view using the respective method, wait for the creation of the container and then select it.
As this is rather messy i would suggest binding the IsSelected to a property on your item using a style for DataGridRow (set it as ItemContainerStyle). Then you can just set the property to true and scroll the item into view if need be.
I have an Ext.grid.EditorGriPanel which has an combobox editor in its columnModel (the store of combox has just only 2 items: enabled/disabled). When a new blank row is inserted to grid, I want the combobox in that column have to be set to a default value (enabled), and the dropdown is not expanded.
I've tried to use
grid.colModel.columns[2].editor.select(0)
to get the combobox editor and set "enabled" value for it, but it did not work. Another way is using grid.colModel.columns[2].getCellEditor(rowIndex), but it returns an EditorGrid (I was so surprised because the ExtJS 3.3.1 API doesn't have this component).
Could you please help me on this problem?
Thank you so much!
When a new blank row is inserted to
grid, I want the combobox in that
column have to be set to a default
value (enabled), and the dropdown is
not expanded.
When the new record is inserted to the grid's store, the value of your column (in the record) needs to be set to "enabled". I'm not sure if you are doing it like this currently? In other words, the value must not be set to the editor of the column. Set it directly in the record.
(Also, you can define default values to be used for all records using the recordType property of the store - see ExtJS API documentation for more details - but this is optional.)
Finally, note that the combobox will not be displayed immediately after the row is added. The combobox is displayed only when you start editing that particular cell - this is the way EditorGrid works in ExtJS. But at least you should get the new row to immediately display the correct value ("enabled") with this advice.