I have a devexpress grid with a column that shows up as a checkbox. How can I disable this checkbox so that the user is not able to click on it, but it still displays a check or a blank box?
I suspect that column will be Boolean Column. Try setting Column.ColumnEdit to TextEdit It will display true or false instead showing CheckEdit.
By default Boolean column uses checkedit in devexpress grid that makes sense.
Note: I've not tested try it out
Related
I'm using WinForms Devexpress and bumped into the following task:
Somehow I need for DevExpress GridView to programmatically set data row selection checkbox to intermediate state (as the state of the top checkbox at the header at the picture below:
I'm wondering if it is possible or how to overcome the issue.
You should set the column editor's AllowGrayed property to true.
this.yourBooleanColumn.ColumnEdit = this.repositoryItemCheckEdit1;
this.repositoryItemCheckEdit1.AllowGrayed = true;
How to use telerik gridcheckboxcolumn and how to keep checked rows when radgrid is bind , for example, when paeg changed , rows that checked is unchecked?
You need to bind the checkbox column to a bit column in the database otherwise the status of the checkbox will be lost when you leave the page. Make sure the checkbox column has the datafield bind to the relevant db column:
<telerik:GridCheckBoxColumn DataField="YourDataFieldInDB" DataType="System.Boolean".......
In C# Windows Forms I have a listview with the CheckBoxes property set to true and the AllowColumnReorder property set to true.
The checkbox for each item is shown at the very left-hand side of the listview inside the first column. If the user now reorders the columns so that another column is the first one of the listview, the checkbox should be shown for this column. So the checkbox should always stay at the very left-hand side of the listview, but it doesn't buy default.
What do I need to do, to always show the checkbox for the leftmost column even if the column order was changed by the user at runtime?
I don't understant.
You put Checkboxes, aside another element into a column?
If yes, why don't you add a column , only for your checkbox, and then set Reorder property to false?
The others columns will always have Reorder property to true, so you can shamble whatever you want, exept the first column.
Using a DataGridView, how can I make a specific column uneditable while the grid view itself has "Allow editing" enabled?
Also, how can I execute an event when the selected index in a ComboBox in the DataGridView has changed? Here, ComboBox is a column type.
Another question is, how can I make the header title aligned to the center? I can't find the appropriate property.
You've got a few questions here.
(1) How can I make a specific column uneditable in DataGridView?
Set the ReadOnly flag on the particular column you want to make uneditable.
dataGridView.Columns["YourColumnName"].ReadOnly = true;
(2) How can I execute an event when the selected index on a ComboBox in the DataGridView changes?
If it's in your DataGridView, it's not a ComboBox; it's a DataGridViewComboBoxColumn. According to MSDN:
Unlike the ComboBox control, the DataGridViewComboBoxCell does not have SelectedIndex and SelectedValue properties. Instead, selecting a value from a drop-down list sets the cell Value property.
This one I'm not familiar with, as I've never tried it myself. It appears you want to subscribe to the EditingControlShowing event and then see if something like this works for you (with a little tweaking).
(3) How can I make the header title align in the center?
Set the HeaderCell.Style.Alignment
dataGridView.Columns["YourColumnName"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
I am currently using a datagridview in C# that is working correctly.
This datagridview has a checkbox field thats linked too a database, I am requiring all rows in the datagridview to be red until the checkbox is checked. Once the checkbox is checked the row will then turn green.
I am also requiring the checkbox field to be the only field in the datagrid that is not read only, but this isnt crucial at this stage. I hope you can offer me some suggestions.
Using visual studio 2010 in a windows forms application
Refer to CellContentClick event.
Read the cell value when user clicks it. If the checkbox is set then get the row index from event handler and write the following line in event handler.
datagrid.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Green;