datagridview

Column cannot be added because its CellType property is null exception

Hi, I have trouble with the following piece of code. When I go through with the debugger I get an exception when it comes to the following line: dgvCalls.Columns.Insert(1, msisnnColumn); I get an exception: Column cannot be added because its CellType property is null. Oddly, I created the same procedure for some other DataGr...

Getting ID of embedded ASP Object using JavaScript and jQuery

I am using jQuery to try and trigger a method when a ASP.Net (2.0) dropdown list's change event is handled by jQuery. The problem is that the drop down list is located inside a gridview and even then only when a user has decided to edit a row within that gridview. I think I have it picking up the object using a ASP code block but the p...

Custom Sorting Of A Bound DataGridView

I have a DataGridView bound to a DataTable. I have one column that's a pseudo-int -- you know the kind, where most of the time it has integers but sometimes instead there's an N/A. This column is a varchar, but I want to have it sort like an int column, treating the N/A as a -1. The DataGridView provides for this -- if it's not bound to...

Background filling a DataGridView from an SqlDataAdapter

I have a large dataset (over 100,000 records) that I wish to load into a DataGridView. The stored procedure that does this can take 10 seconds or more to complete. So far I have a BackgroundWorker preventing the UI from locking up, and have implemented a rudimentary 'Please Wait' dialog. What I'd like to do is somehow populate the Data...

DataGridView Column sorting with Business Objects

I am setting-up my DataGridView like this: jobs = new List<DisplayJob>(); uxJobList.AutoGenerateColumns = false; jobListBindingSource.DataSource = jobs; uxJobList.DataSource = jobListBindingSource; int newColumn; newColumn = uxJobList.Columns.Add("Id", "Job No."); uxJobList.Colum...

WaitCursor on sort in DataGridView

I am using the standard .Net 2.0 DataGridView with sort mode of automatic on the column. It is very very slow (which should probably be another question on how to speed it up) but I can't seem to find an event or combination of events that will maintain a WaitCursor while this sort operation is being performed. Ideas? ...

How do I get the error icon used by DataGridImageCell?

I display some objects that have thumbnails in two ways: one in a DataGridView, and one in a custom control. In the DataGridView, the thumbnail is displayed in a DataGridViewImageCell. If the thumbnail is missing, the cell displays an error icon. I want to show that icon in my custom control, too. How do I get hold of it? Preferably...

Quickest way to display results from a table in .NET 2.0/3.5

Hi, I have a database table (sql server 2008) that I want to view data for, what is the quickest way of displaying this data? (if it could have paging that would be perfect). Would it be a gridview or ? query: select * from testData ...

DataGridView: how to focus the whole row instead of a single cell?

I'd like to use the DataGridView control as a list with columns. Sort of like ListView in Details mode but I want to keep the DataGridView flexibility. ListView (with Details view and FullRowSelect enabled) highlights the whole line and shows the focus mark around the whole line: DataGridView (with SelectionMode = FullRowSelect) displ...

DatagridView Not Displaying the error icon or error text?

I have a win form (c#) with a datagridview. I set the grid's datasource to a datatable. The user wants to check if some data in the datatable exists in another source, so we loop through the table comparing rows to the other source and set the rowerror on the datatable to a short message. The datagridview is not showing these errors. ...

DataGridview Column Resize Problem

I have a datagridview where the users can select which subset of columns to view. The problem I am having is that when I change the columns being displayed, the column widths are only being determined by the width of the Header Cells, not the data in it. I do have each column set to AutoSizeMode = AllCells. If a new row is added, the c...

Dump stored proc output params into a DataGridView row

Hi, i'm a long-time newbie to c#, and this question may be too obvious, so please forgive if i'm "doing it wrong." Using Visual Studio 2005 Pro, C#, SQL Server 2000 EE SP3. I have a stored proc that takes one input param and returns several output params pertaining to that input. I am also calling it successfully, and String.Format-ing...

DataGridView/DataSet update

I'm having trouble saving a new row in the DataGridView back to the database. Briefly, 1) I use a SqlDataAdapter to fill a DataTable in a DataSet. 2) The DataTable is the DataSource for a Grid View. 3) If the user clicks on the blank "new row" at the bottom of the DataGridView, I capture the new, empty row of in the RowEnter event and...

Programatically changing the culture of a DataGridView?

I'd like to change the pricing column on my DataGridView based upon currency a user selected currency ComboBox. Currently, the price column is formatted to "C2". This defaults to look like "$1.00". However, if my user were to switch the currency to be Great British Pound, I'd like to display the Great British Pound sign ("£") rather ...

How to Query A DataGridView Using Linq

I have a DataGridView that I want to query using Linq (C# WinForm). I want to "count" rows where a certain criteria is met. For example, variable1 = "count rows where ColumnBoxAge > 3 || < 5" label1.Text = variable1 How to do this in C# WinForm using Linq? ...

DataGridView Filtering OnClick Event (C# WinForm)

How to filter my datagridview by the value of my label.text on click event? That value is from my linq query: dataSet.Tables[0].AsEnumerable().Where(c => c.Field<int>("ageColumn") > 3 && c.Field<int>("ageColumn") < 5).Count(); Let's just say the above query gives me 12 (label.text = 12), now when I click "12", I want my datagridv...

Join Tables in .NET DataSet to Display in DataGridView

I have two tables in a DataSet in .NET. I want to join them on an ID column. Then I want a DataGridView to display two columns from the first table and one column from the second table. If it makes it easier, the relation between the two tables is one-to-one. Can it be done? ...

How to add records in datagridview vb.net

Hi How to add new record to datagridview control in VB.net, I don't use Dataset or database biding at all, all I have is small form with 3 entries, when the user click OK, that will be added to the datagridview control as new row. Thanks ...

Controlling C# DataGridView with an Arraylist in VS2008

I'm having some problems with a datagridview element I'm using in VS2008. This DataGridView is actually a tab in a TabControl element. I gave it 5 colums which need to be filled up with elements from a costum Object i made. It's basically a small library application which contains a main class and several classed derived from it. They ...

How to get keypressed, keydown events from DataGridView data cells

Hi. I need to receive the key press events during cell editing in DataGridView control. From what I have found on the net the DataGridView is designed to pass all key events from DataGridView to the cell editing control and you cannot get these events easily. I found this piece of code that traps those events for DataGrid control, but...