datagridview

asp.net GridView not showing data from Stored Procedure

I have two GridViews, the first works fine as I defined the datasource when I dropped it onto the asp page via visual studio and I specified the table to use. The other GridView (dgvParams below) has just been dropped onto the asp page and I want to use it at run time: Imports System.Data Imports System.Data.SqlClient Imports myDataBas...

DatagridView: Remove unused space ?

I was wondering whether it is possible to remove the unused space ( the gray space ) of the DataGridView control in C#. I have to make the DataGridView display the white table only. Any suggestions ? ...

Can you use ScrollIntoView() with a PagedCollectionView in a Silverlight DataGrid?

Is it possible to scroll to a particular row (by object identity) in a Silverlight DataGrid that has an ItemsSource which is a PagedCollectionView. I am loading a list of orders that are grouped by day/status etc. I need to be able to scroll to a particular order. var pcv = new PagedCollectionView(e.Result.Orders); gridOrders.ItemsSo...

OnClick event in WinForms DataGridView

Hi everyone, I am using DataGridView in WinForms and by this piece of code I am assigning it columns and values dataGrid.DataSource = sourceObject; only by this line all the columns and values into the grid. How do I handle the onClick event of a specific row or field. I want to do edit a particular item in the grid but I cannot fi...

can datagrid columns can be adjusted in c# windows application

hai how can we Adjust the column widths based on the displayed values in a datagrid in c# windows application?. ...

When should I use a datagrid and when should I use a datagridview?

MSDN says, The DataGridView control is a new control that replaces the DataGrid control in .NET Framework 3.5. In any project in VS2008, there is no datagrid control listed in the tool box and only gridview control is present. The MSDN page also describes all the features that gridview provides and datagrid doesnt - Can anyone tell me i...

Determine if Tables[0] Exists

While executing the following statement to bind my database to my datagridview, I get this error: Cannot find table 0. How can I determine if Tables[0] exists prior to executing this statement? : myDataView = myDataSet.Tables[0].DefaultView; I am using SQL Server 2005 Express. ...

Switching tab resets databound selection.

I've been working on a C# project which uses a TabControl. I have a DataTable which is bound, using the same DataView to two different entities, a ListBox in one tab, and a DataGridView in another. I've started saving the user's selection for those controls between launches. At launch, both the ListBox and the DataGridView are set to ...

C# How to change row color in datagridview?

I would like to change the color of a particular row in my datagridview. The row should be changed to red when the value of columncell 7 is less than the value in columncell 10. Any suggestions on how to accomplish this? Thanks. EB ...

C# How to change row color in datagridview?

I would like to change the color of a particular row in my datagridview. The row should be changed to red when the value of columncell 7 is less than the value in columncell 10. Any suggestions on how to accomplish this? Thanks. EB ...

C# DataGridView Adding a Row - When validating, how do I know the row is new and not yet committed?

I have a client having a problem with a DataGridView in a Windows app. They are calling the CellValidated event, but they want to have different validation for the cell if it is in a row that is already committed back to the datasource than if it is a row that is first being added (and not yet committed (the user hasn't left the row yet...

AutoResizeColumnHeadersHeight only works if I set a breakpoint!

Using VB.Net I want to automatically size the height of the headers in a DataGridView so I am calling AutoResizeColumnHeadersHeight during the form load after the data has been populated. The method doesn't appear to do anything, but does work if I do the following: - put a breakpoint on grid.AutoResizeColumnHeadersHeight() - open quick...

datagridview apply cellstyle to cells

I used this example to create a DateTime column for a DataGridView in my winforms app. http://msdn.microsoft.com/en-us/library/7tas5c80.aspx I can see the new column in the Windows Forms Designer and add it to an existing DataGridView. However, I want to be able to change the display format when I change the "DefaultCellStyle" within t...

ASP.NET GridView Row Methods Counterparts in WinForms DataGridView

Are there any ASP.NET GridView's RowCreated, RowDataBound counterpart methods? All I want is to break a string into lines before displaying. I've put Environment.NewLine to create a line break but have no success till now. So I think I need to RowCreated or RowDataBound, etc. events to make modifications. ...

datagridviewcomboboxcolumn not returned with datagridview

Hi i have created a datagridview that is populated with data from the database. When i am displaying the data in my application I add two datagridviewcomboboxcolumns which contain a list of selectable values. These display correctly in the application. The idea is that a user selects a value then hits a button that will take the...

How to save records in a datagrid?

I would like to save the records in my datagridview. (I'm not talking about using the save_button click event). I would like to treat my datagridview much like a calender in that you should be able to scroll forward and backward by month and view previous data records while the new month dynamically displays all the data so I don't hav...

Binding excel file to datagridview

I am trying to bind excel file to dataGridView strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=E://Org.xls;" + "Extended Properties=" + (char)34 + "Excel 8.0;HDR=Yes;" + (char)34; OleDbConnection conn = new OleDbConnection(strConn); textBox1.Text = "t...

VB.NET: Clear DataGridView

I've tried - DataGridView1.DataSource=Nothing and DataGridView1.DataSource=Nothing DataGridView1.Refresh() and DataGridView1.RefreshEdit() None of them works.. I've written a method that sets the DataSource of the DataGridView when executed. but each time i execute it, it replicates the data with new value and appends it to the...

How do you jump to a particular row in a DataGridView by typing (a la Windows Explorer details view)

I have a .NET Winforms app in C# with a DataGridView that's read-only and populated with some number of rows. I'd like to have functionality similar to Windows Explorer's (and many other applications) details view for example. I'd like the DataGridView to behave such that when it has focus if you start typing, the current row selection ...

Drag and Drop from TreeView to a DataGridView within a Container control.

Howdy, I got stuck in a situation. I have completed all of my codes necessary to drag and drop from a TreeView to a DataGridView, and the code works fine. Set DataGridView AllowDrop to True, set all the necessary handlers to accommodate dragging and dropping data from a populated TreeView control ( using a directory structure ). What...