How to simulate a column header click in devexpress xtraGrid? - c#

Hi I have a devexpress grid on the form. I enable the incremental search on one of the columns. But I find I need to click the column header each time when I perform one search. Is there a way to simulate such header or column click in grid control?
I also try in gridcontrol_keydown event to set the focused row, but this one only works for once, after performing one search, I need to click the column header or the column again, otherwise the incremental search doesn't work anymore.
Thanks!

The column (or cell) click is required only to set focus to the column under which you want to search data. It is possible to focus a column programmatically. Use the ColumnView.FocusedColumn property.

Related

Filter a Kendo UI MVC Grid using checked items in a checkbox column

I have a Kendo UI MVC Grid where I'd like to add a special checkbox column.
This column will not be bound to a model but will be used like a sort of filter.
The idea is that users can check some rows and then click a button (for instance the filter icon in the column header). When clicked, the grid should collapse to the selected rows. The way I see it, it is an extra filter, but not the usual way.
The way my users will work with it would be about as follows:
They select a row and play the attached sound file for that row.
If the row holds an interesting sound file, they may check the checkbox and move to a new row -> 1.
After the selection with checkboxes is made, they will click on the checkbox column filter icon.
The selection will then collapse to the rows that were selected.
After this, the collapsed grid may be exported to excel, pdf or whatever…
A multi select grid is not an option as well as a checkboxed column filter because the selection is not instant, but a process over time.
I cannot find how I would make #4 work. Any suggestions? I don't need a complete solution, ideas are welcome.
The best way is to add boolean 'util' property to your model and bind it to a checkbox column. Once your checkbox column will be bound, your button can execute:
dataSource.filter({ field:"Field", operator: "eq", value: true });
As far I know - there is no build kendo way to manage filtering unbounded columns.

Display System.Windows.Forms.DataGridView new Record row at the top instead of bottom?

When you use the System.Windows.Forms.DataGridView and set the AllowUserToAddRows property to true, it displays a blank row at the bottom of the grid which users can use to add new rows to the grid. I want this row to display at the top of the grid instead of at the bottom, but cannot figure out how to do that. I found this MSDN page, which says
The DataGridView control supports this functionality by providing a row for new records, which is always shown as the last row.
So I'm not sure if it's actually possible to have it display at the first row, but thought I'd ask anyways. My DataGridView is data bound if that makes a difference.
Update
It looks like it's not possible to have the "new row" show at the top of the grid, so what I did instead was changed my columns to sort descending, rather than ascending, and programmatically scroll the data grid view to the bottom of the list when the form is loaded. Not the ideal solution I was looking for, but it's the next best thing.
Instead of using AllowUserToAddRows, you could instead create an "Add row" button. When the button is clicked, it programmatically inserts a row at index 0 using code such as:
myDgv.Rows.Insert(0,1)

Allowing user to change column order of the datagrid view

I am using Win forms and have a databound DataGridView which has around 31 columns.
AllowUserToOrderColumn is set to true. But since the number of column is 31 its quite difficult for the user to move columns from one end to another.
so I want to create a form which will display all the columns of the datagridview and with the click of up down button allow them to change the order.
I have named my textBox(readonly) from textbox0 to textbox30.
Is there any way to display the column order in text boxes.
Like when we click EditColumns in the designer view.
Certainly:
Look at the DisplayIndex of the columns -> http://msdn.microsoft.com/en-us/library/wkfe535h.aspx
With this, you should be able to read them and change them by code.

Using keystrokes to select DataGridView row

Hello I have a datagridview with many rows. I would like to be able to click on a cell and type some letters and have a matching row get selected (or scroll to it). I can sort out which column it is sorting to, but right now there is no 'search' capability.
When you open a Window's Explorer window and click on a file, you can start typing to have the selection move to the file/folder that matches your keystrokes.
Is this possible with the datagridview?
What I meant was the DataGridRow.IsSelected property. Since you said you know which rows contains your results, you can call DataGridView.ClearSelection() and then set the IsSelected property of the row that contains the data to true.

How can I remove unnecessary columns in a DataGridView?

How do I remove the specific column, from a DataGridView control, that is indicated in the picture?
That particular column is called a Row Header. Its purpose is to allow the user to select the entire row with a single click, and to indicate which row is currently selected.
You can hide it by setting the RowHeadersVisible property of the DataGridView control to False.

Categories