I have a datagridview bound to a datasource, and in each row in the grid there is a category, product, and quantity. I want to filter the products in each row according to the selected category.
I'm using C# and DevExpress. How can I do this?
Please refer to the How to filter a second LookUp column based on a first LookUp column's value article which explains how to implement this feature.
Depending on how You want to filter you can set
gridView1.OptionsCustomization.AllowFilter = true;
This will display an additional filter row in your grid that will allow you to filter all columns by any text you want;
Or you can make sure that gridView1.OptionsCustomization.AllowFilter is set to true. Then there should be little icon on your column header (visible in right top corner when you move cursor over the column header) that will display filter after you click it.
Related
I'd like to show a listview in a C# application where every row represents a product so the property "view" is set on "detail". One column (the last one) should be a checkbox because it represents if the product is discountinued.
With the checkboxes property set to true, a checkbox appear in the first column so it doesn't work for my application.
How can add the checkbox to the last column? Thank you
The Checkboxes are always associated with the first Column. However you change re-order the display of the Columns.
All you need to do it go to the Columns designer and set the 1st colum's DisplayIndex to the last column's index.
Or do it in code:
listView1.Columns[0].DisplayIndex = listView1.Columns.Count - 1;
listView1.Invalidate();
Note the Invalidate which is necessary to enforce the display of the new layout..
How to make a Row select highlight specific Cells and not all the Row in a Grid View. I have explored all the questions on SOF, but there is nothing is available.
Set the SelectionMode property of the Grid to CellSelect
You need the set the selection mode on the Grid to cell selection.
If you want it to act like a row select but keep a few cells un-highlighted you should use CellSelect as the selection mode. Then register on row selection changed and set the cell.Selected = true; for the ones you want selected, and false for the rest.
I found the solution !! If you want to control the highlight of a row to a certain range of cells, then you need to control the behavior of the cells in question and make them behave differently when the a row is selected.
YourGridviewInstance.GetCellRange(int topRow,int leftColumn,int buttomRow,inr RightColumn)
in other words
YourGridviewInstance.GetCellRange(YourCurrentRow, The column you want to affect,YourCurrentRow, The Same Column you want to affect)
I am using a "DevXpress.XtraGrid.GridView" and I have a column there which is bound to a boolean data. This column shows check boxes to represent values. I need to show "YES/NO" instead of check boxes. Please advice me.
Thanks for helping,
Kushan Randima.
This is how I do it in code in one of my tools. This is a dynamic SQL Query tool and it returns a checkmark or red X beside the query result, at runtime. You can also do this through the designer but this is done in code.
This is for Winforms, but the low level GridView should be the same code for WPF (I am not positive).
First, in the Data Grid GridView designer, I add a column (mine is "IsError" column). Then in my form constructor or InitializeForm() I do this:
RepositoryItemCheckEdit checkEdit = gridOutput.RepositoryItems.Add("CheckEdit") as RepositoryItemCheckEdit;
checkEdit.PictureChecked = global::Gyrasoft.Common.DX.Properties.Resources.exclamation;
checkEdit.PictureUnchecked = global::Gyrasoft.Common.DX.Properties.Resources.accept;
checkEdit.CheckStyle = DevExpress.XtraEditors.Controls.CheckStyles.UserDefined;
gridViewOutput.Columns["IsError"].ColumnEdit = checkEdit;
The resources, of course, have to be valid images.
Basically you add a repository item (RepositoryItemCheckEdit) and set CheckStyle to UserDefined, and assign the checkEdit to the gridView column. You can add the same checkedit to multiple columns. It is simply for rendering or editing.
I have jqgrid with 4 columns each with checkboxes format, I need to get All the checkboxes values selected and unselected values based on Column Names.Is it possible?
Updated : Grid Image
The demo from the answer shows how to add custom button in the column header of jqGrid. In the click event handler you can enumerate all rows of the grid and set the column contain to true or '1' depend on the way how you defined the column. In the way you can implement your requirements.
I want to sort Grid View on the basis of paticular column.
For example:
alt text http://img30.imageshack.us/img30/5673/tablezz.jpg
Now i want to sort above table in such a way that all Developers should come first.
Thanx
First set the Allowsorting Property of the Gridview to true.
Then set the SortExpression property of the Occupation column to correponding column of your data source.
For example:
yourGridView.Columns[2].SortExpression = "YourDataSourceColumnName"