DataGrid, don't want the last row (new record), how to remove 
Author Message
 DataGrid, don't want the last row (new record), how to remove

I have a datagrid that is bound to a table.

I want the data displayed and allow the user to select a record.  But I
don't want the blank last row displayed.  I don't want them to be able to
enter new data in this datagrid.  This one is for selecting a record only.

Thanks for any help



Mon, 21 Mar 2005 21:38:34 GMT  
 DataGrid, don't want the last row (new record), how to remove
Hi Chris
To allow editing while not allowing the new row to appear then
you'll need to either bind to or get the DataView that the Grid uses as an
intermediary between the UI and the DataTable.
Once you have the DataView it has an AllowNew property that prevents new
rows being added from the DataGrid if you set it to false. It's also got an
AllowEdit property if you want to restrict that as well, or you could just
set the entire datagrid ReadOnly property to true.

You can create a DataView and bind that to the grid by using the following
code
DataView dv = new DataView(myTable);

or once you have bound to the grid you can get the DataView using this code
CurrencyManager cm =
(CurrencyManager)myDataGrid.BindingContext[myDataGrid.DataSource];
DataView dv = (DataView)cm.List;

Hope that helps
J.

Jasmine
www.datagridcolumnstyles.net
Custom DataGridColumnStyles for the Microsoft .Net Windows Forms DataGrid

Quote:

> I have a datagrid that is bound to a table.

> I want the data displayed and allow the user to select a record.  But I
> don't want the blank last row displayed.  I don't want them to be able to
> enter new data in this datagrid.  This one is for selecting a record only.

> Thanks for any help



Mon, 21 Mar 2005 21:57:18 GMT  
 DataGrid, don't want the last row (new record), how to remove
No, I don't want any editing on this grid either.  Does that make it easier?

Thanks



Quote:
> Hi Chris
> To allow editing while not allowing the new row to appear then
> you'll need to either bind to or get the DataView that the Grid uses as an
> intermediary between the UI and the DataTable.
> Once you have the DataView it has an AllowNew property that prevents new
> rows being added from the DataGrid if you set it to false. It's also got
an
> AllowEdit property if you want to restrict that as well, or you could just
> set the entire datagrid ReadOnly property to true.

> You can create a DataView and bind that to the grid by using the following
> code
> DataView dv = new DataView(myTable);

> or once you have bound to the grid you can get the DataView using this
code
> CurrencyManager cm =
> (CurrencyManager)myDataGrid.BindingContext[myDataGrid.DataSource];
> DataView dv = (DataView)cm.List;

> Hope that helps
> J.

> Jasmine
> www.datagridcolumnstyles.net
> Custom DataGridColumnStyles for the Microsoft .Net Windows Forms DataGrid


> > I have a datagrid that is bound to a table.

> > I want the data displayed and allow the user to select a record.  But I
> > don't want the blank last row displayed.  I don't want them to be able
to
> > enter new data in this datagrid.  This one is for selecting a record
only.

> > Thanks for any help



Mon, 21 Mar 2005 22:08:15 GMT  
 DataGrid, don't want the last row (new record), how to remove
Readonly works, but is it possible to keep the Blue Selection instead of the
gray selection?

Thanks



Quote:
> Hi Chris
> To allow editing while not allowing the new row to appear then
> you'll need to either bind to or get the DataView that the Grid uses as an
> intermediary between the UI and the DataTable.
> Once you have the DataView it has an AllowNew property that prevents new
> rows being added from the DataGrid if you set it to false. It's also got
an
> AllowEdit property if you want to restrict that as well, or you could just
> set the entire datagrid ReadOnly property to true.

> You can create a DataView and bind that to the grid by using the following
> code
> DataView dv = new DataView(myTable);

> or once you have bound to the grid you can get the DataView using this
code
> CurrencyManager cm =
> (CurrencyManager)myDataGrid.BindingContext[myDataGrid.DataSource];
> DataView dv = (DataView)cm.List;

> Hope that helps
> J.

> Jasmine
> www.datagridcolumnstyles.net
> Custom DataGridColumnStyles for the Microsoft .Net Windows Forms DataGrid


> > I have a datagrid that is bound to a table.

> > I want the data displayed and allow the user to select a record.  But I
> > don't want the blank last row displayed.  I don't want them to be able
to
> > enter new data in this datagrid.  This one is for selecting a record
only.

> > Thanks for any help



Mon, 21 Mar 2005 22:10:19 GMT  
 DataGrid, don't want the last row (new record), how to remove
you have to change the readonly property for the datagrid to true

regards

Quote:

> I have a datagrid that is bound to a table.

> I want the data displayed and allow the user to select a record.  But I
> don't want the blank last row displayed.  I don't want them to be able to
> enter new data in this datagrid.  This one is for selecting a record only.

> Thanks for any help



Mon, 21 Mar 2005 22:09:16 GMT  
 DataGrid, don't want the last row (new record), how to remove
I don't think there is a setting for readonly selection text color, I think
it's probably determined by the either the datagrid itself or is related to
the color scheme of your operating system. I'm not 100% sure about that,
someone else might know a way to change it.

J.

Jasmine
www.datagridcolumnstyles.net
Custom DataGridColumnStyles for the Microsoft .Net Windows Forms DataGrid

Quote:

> Readonly works, but is it possible to keep the Blue Selection instead of
the
> gray selection?

> Thanks



> > Hi Chris
> > To allow editing while not allowing the new row to appear then
> > you'll need to either bind to or get the DataView that the Grid uses as
an
> > intermediary between the UI and the DataTable.
> > Once you have the DataView it has an AllowNew property that prevents new
> > rows being added from the DataGrid if you set it to false. It's also got
> an
> > AllowEdit property if you want to restrict that as well, or you could
just
> > set the entire datagrid ReadOnly property to true.

> > You can create a DataView and bind that to the grid by using the
following
> > code
> > DataView dv = new DataView(myTable);

> > or once you have bound to the grid you can get the DataView using this
> code
> > CurrencyManager cm =
> > (CurrencyManager)myDataGrid.BindingContext[myDataGrid.DataSource];
> > DataView dv = (DataView)cm.List;

> > Hope that helps
> > J.

> > Jasmine
> > www.datagridcolumnstyles.net
> > Custom DataGridColumnStyles for the Microsoft .Net Windows Forms
DataGrid


> > > I have a datagrid that is bound to a table.

> > > I want the data displayed and allow the user to select a record.  But
I
> > > don't want the blank last row displayed.  I don't want them to be able
> to
> > > enter new data in this datagrid.  This one is for selecting a record
> only.

> > > Thanks for any help



Mon, 21 Mar 2005 22:25:34 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. ItemRemove event don't fire when removing last item in items collection object

2. Crystal DON'T show the last record (sometimes), reprinting DO

3. Remove last non fixed row of grid control

4. How can I remove last non-fixed row?

5. Don't want new New Word Application

6. HowTo: Skip the last row in DataGrid?

7. Recordcount always 0 after deleting the last row when bound at a Datagrid

8. Move to the last row in a Datagrid

9. Move to the last row in datagrid

10. Last row in datagrid

11. Textbox/label which add a new line and remove the last line

12. CR7 don't show the last dates ??

 

 
Powered by phpBB® Forum Software