We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

GDBG AddNew row vs. data table in event handler

Thread ID:

Created:

Updated:

Platform:

Replies:

61102 May 17,2007 05:07 PM May 17,2007 10:33 PM Windows Forms 4
loading
Tags: GridControl
Rob Yang
Asked On May 17, 2007 05:07 PM

Hi, we have a GDBG with three columns - let's call them A, B, C and D - which are as follows :

A - ID (integer, readonly)
B - string column (changeable)
C - string column (readonly)
D - button (clickable)

The grid data source is set to a data table which contains columns A - C and an undisplayed column E.

We have a CellButtonClicked handler for the grid which is supposed to fill in columns C and D based on some user interaction. However, the problem is that for the AddNew row at the bottom of the grid, no corresponding data row exists yet in the data table when the handler is executed.

Is there a good way of dealing with this ? Thanks for any assistance !
-Rob

Rob Yang
Replied On May 17, 2007 05:14 PM

Sorry, let me try that again - I was a little distracted while typing that :)

>Hi, we have a GDBG with four columns - let's call them A, B, C and D - which are as follows :

A - ID (integer, readonly)
B - string column (changeable)
C - string column (readonly)
D - button (clickable)

The grid data source is set to a data table which contains columns A through C and an undisplayed column E.

We have a CellButtonClicked handler for the grid which is supposed to fill in columns C and E based on some user interaction. However, the problem is that for the AddNew row at the bottom of the grid, no corresponding data row exists yet in the data table when the handler is executed.

Is there a good way of dealing with this ? Thanks for any assistance !
-Rob

Saravanan A [Syncfusion]
Replied On May 17, 2007 05:45 PM

Hi Rob,

In GDBG, the AddNew row is used to add the new record to the underlying datasource at the runtime. When the user enter any data in that row and move to some other row then Binder.EndEdit() method will be called internally and that will add this new row to the datasource. So till you navigate to some other row after editing it for the first time, there wont be any record corresponding to that row in the datasource.
If you dont want this addnew row the set the EnableAddNew property of the GDBG to false.


Best Regards,
Saravanan.

Rob Yang
Replied On May 17, 2007 09:45 PM

Thanks Saravanan, that is helpful to know.

We would like to allow the user to add new rows via the AddNew row. When the user clicks the button in the AddNew row, we want the columns C and E to be filled in. However, I'm not sure what steps need to be taken programmatically - simply calling Binder.EndEdit() does not seem to add a new row. Is what we want to do possible ?

Thanks !
-Rob

>Hi Rob,

In GDBG, the AddNew row is used to add the new record to the underlying datasource at the runtime. When the user enter any data in that row and move to some other row then Binder.EndEdit() method will be called internally and that will add this new row to the datasource. So till you navigate to some other row after editing it for the first time, there wont be any record corresponding to that row in the datasource.
If you dont want this addnew row the set the EnableAddNew property of the GDBG to false.


Best Regards,
Saravanan.

Rob Yang
Replied On May 17, 2007 10:33 PM

Actually never mind, it seems that this does what we need :

grid.Binder.EndEdit();
grid.CurrentCell.MoveTo(e.RowIndex - 1, e.ColIndex);
grid.CurrentCell.MoveTo(e.RowIndex, e.ColIndex);

Thanks again !
-Rob

>Thanks Saravanan, that is helpful to know.

We would like to allow the user to add new rows via the AddNew row. When the user clicks the button in the AddNew row, we want the columns C and E to be filled in. However, I'm not sure what steps need to be taken programmatically - simply calling Binder.EndEdit() does not seem to add a new row. Is what we want to do possible ?

Thanks !
-Rob

>Hi Rob,

In GDBG, the AddNew row is used to add the new record to the underlying datasource at the runtime. When the user enter any data in that row and move to some other row then Binder.EndEdit() method will be called internally and that will add this new row to the datasource. So till you navigate to some other row after editing it for the first time, there wont be any record corresponding to that row in the datasource.
If you dont want this addnew row the set the EnableAddNew property of the GDBG to false.


Best Regards,
Saravanan.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;