datagridview

How to enable sorting on a DataGridView that is bound to a LINQ to Entities query?

I have a query as such (simplified): var q = from t in _entities.Table order by t.Id select new { Id = t.Id, Name = t.FullName }; MyDataGridView.DataSource = q; However, it seems that I can't click on the Column Header and get it to sort (switching between ascending and descending) on...

Block columns in DataGridView

Hi Everybody, Again a c# question I cant't seem to figure out: I have a datagridview on my form. In Visual Studio design mode, I enter 4 columns: refernce, country, name & city. After a searchform is filled in, I try to refresh the datasource: A custom class fetches all the data from the selected table and fills the datagridview. The p...

DataGridView save filtering after reload

Hi, I have some problem with DataGridView in C#. case is: I do some update on database then I reload DataGridView with new values: myDataGridView.DataSource = myDataSet.Tables[0] Everything is ok, but recently I was asked if there is possibility to keep the same column filtering applied after reloading data? What would be approach...

add data to DataGrid View through DataSet?

Hello, I have a datagridview that is bound to a dataset I defined the table and the columns, how I can programmaticlly insert data to it? I did this http://msdn.microsoft.com/en-us/library/5ycd1034%28VS.71%29.aspx but it did not show the data in my DataGridView !!! ...

sorting rows in databound datagridview

Greetings. I have a DataGridGiew, bound to a object datasource - List<SomeType>. I want to sort it by string representations of fields values (ignoring real types) with grid header clicks. I have many grids, that are bound to many lists of different object types. How can i do this as fast as possible? Thanks in advance p.s. framework 2...

Lock location of slider of datagridview

I have grid, where I have a lot of records. There is operation like selecting row, and in other window I do some things with this row. So i have a delegate to the second window. When delegate is fired I'm refreshing my grid. I don't know how to lock slider to be in place, where I select this old record. So, if this record wa 43th...

Data Grid View -- binding columns to list

Hello, My project in c# cantains dataGridView and i have a object contain data. public class Data { public List list {get;set;} } the data is init at program start up and the length of list can change. i want to bind the gridView to object that when gridView show each columns in gridview is bound to list in data object like this:...

Any easy to use php mysql datagrid?

Hi Anyone know of a FREE and easy to use PHP MySQL Datagrid class? I have used rGrid and Eyesis but need something like phpdatagrid. No requirement of AJAX features though. Just need basic features inbuilt like search by columns, pagination with page numbers(with jump to page dropdown), how many rows to show per page, multiple delete etc...

saving each item while in loop vb.net

i need to make my storedprocedure update as as the messabox reads each item of a datagridview. it only save the last record that messagebox read. need help:( For Each row As DataGridViewRow In DataGridView1.Rows Dim strunitprice As String = CDbl(row.Cells(7).FormattedValue) + Val(CDbl(TXTNET.Text)) 'op...

DataGridView List<T> column?

I have a datagridView, that is bound to a List. This List is made up of my class which contains 2 public properties, a String Name, and another List CustomList. See below: public class MyClass2 { public string Name { get; set;} public string Description { get; set; } } public class MyCla...

Display a single object with a DataGridView.DataSource

I'm used to display multiple objects with a DataGridView control in the following format ID Name Address [...] ID1 Name1 123 street [...] ID2 Name2 456 street [...] This is simple to do with objects, properties and a BindingList<>. I'd like my data to be "rotated" 90 degrees so that the grid displays a ke...

DataGridView Custom Sort in WinForm

My DataGridView control currently sorts using the Sort property of the bound data, but it isn't doing what I want it to do. I have a column called Employee that is displayed as "Firstname Lastname". When I sort by Employee, Amy Z_Lastname is listed before John A_Lastname, meaning I would prefer to sort by last names. I could break the...

.Net: DataGridView Responding to IBinding.ListChanged but not CellValueChanged Event Handler

I have a custom IBinding List which raises the ListChanged event. I would like to recolor the Datagridview row after the ListChanged event. The Datagridview is responding to ListChanged event and changes the cell value but the CellValueChanged event is never fired. What Datagridview event reflects the ListChanged event? Class CustomL...

Refresh datagridview in windows form application

Hello, I have a form with datagridview and a List like this: private void Form1_Load(object sender, EventArgs e) { List<Person> list = new List<Person>(); list.Add(new Person("A", "An Giang")); list.Add(new Person("B", "TP HCM")); list.Add(new Person("C", "Tiền Giang")); ...

VB.NET Winforms menu item shortcuts overriding default shortcuts?

In a VB.NET Winforms application, I have a form that contains both a datagridview and a textbox. I have some menu item entries that have shortcuts of Ctrl-X, Ctrl-C, and Ctrl-V that operate on the datagridview. However, these override the default cut, copy, and paste shortcuts for the textbox. How can I make the menu shortcuts only ap...

binding dateGridView column to list

Hello, My project in c# cantains dataGridView and i have a object contain data. public class Data { public List list {get;set;} } the data is init at program start up and the length of list can change. i want to bind the gridView to object that when gridView show each columns in gridview is bound to list in data object like this: if ...

DataGridView, databinding, and ComboBox filtering

Hello, I have a DataGridView with a combobox column in it, showing the possible prices, and I would like to only display the prices relevant to the particular row. In more details, let's say that I have a class method which returns me a dataset with 2 tables populated (feeded by a stored procedure running on a SQL Server 2005 database)...

Format the list items from the DataGridViewComboBox

Hello, I'm displaying prices on a DataGridView (on a WinForms application developped in C# on VS 2008). The column type is DataGridViewComboBoxColumn. The DefaultCellStyle.Format property for this column is set to "C2" and the prices are indeed formatted as currency in the cells of this column. However, when the user clicks the ComboB...

Automatically setting foreign keys & autonumbers in new DataGridView rows?

I have an order table with the following columns: orderid, clientid, [columns for order details] ... I am then displaying this table, for a specific client, using a DataGridView. I have both the orderid and clientid columns hidden, however, as the orderid is a autonumbered primary key and the clientid is constant. Unfortunately, when...

DataGridView HasErrors?

I wish to prevent the user from saving changes made to a DataGridView if it has any validation errors (set using the ErrorText property of a cell using the CellValidating event). I'm looking for (but cannot see) a method such as myDataGridView.HasErrors()? ...