Setting row values when adding in GDBG
I have a GridDataBoundGrid control that has its DataSource set to a DataView with a filter "simulation_id = n". Obviously, I don't want to display the simulation_id column, since it is already filtered by this value. How do I intercept the saving of a new row so that I can set this column value? There is a RowSaved event, but this is too late. A "RowSaving" event would be most useful. Thanks
Dave Taylor
Dave Taylor
SIGN IN To post a reply.
3 Replies
RC
Rajadurai C
Syncfusion Team
November 9, 2009 06:49 AM UTC
Hi David,
Thanks for your interest in Syncfusion Products.
With griddataboundgrid binded to datasource and rowfilter applied in, you can set the text to the column which is hidden and by which rowfilter has been applied, while adding, by means of the following code which is handled in a button' Click event in the attached sample.
http://files.syncfusion.com/support/samples/Grid.Windows/7.4.0.15/F91165.zip
Regards,
Rajadurai
Thanks for your interest in Syncfusion Products.
With griddataboundgrid binded to datasource and rowfilter applied in, you can set the text to the column which is hidden and by which rowfilter has been applied, while adding, by means of the following code which is handled in a button' Click event in the attached sample.
http://files.syncfusion.com/support/samples/Grid.Windows/7.4.0.15/F91165.zip
Regards,
Rajadurai
AD
Administrator
Syncfusion Team
November 9, 2009 03:59 PM UTC
Rajadurai,
Thanks for the reply, but I think I may not have been precise enough in my question. I want to do this when the user adds a row by using the GDBG's built-in row addition method (i.e. placing the cursor on the last row to add a new record). My first thought was the "RowSaved" event, but this is too late...hence the request for a "RowSaving" event which would make this so much easier, or another work-around.
Thanks
Dave Taylor
Thanks for the reply, but I think I may not have been precise enough in my question. I want to do this when the user adds a row by using the GDBG's built-in row addition method (i.e. placing the cursor on the last row to add a new record). My first thought was the "RowSaved" event, but this is too late...hence the request for a "RowSaving" event which would make this so much easier, or another work-around.
Thanks
Dave Taylor
RC
Rajadurai C
Syncfusion Team
November 10, 2009 09:25 AM UTC
Hi David,
While adding new row through the addnewrow in griddataboundgrid, you can set the hidden column value by handling the RowLeave event through the following code.
This event get triggerred before RowSaved event get fired.
Here is the modified sample in which the above mentioned code has been implemented.
http://files.syncfusion.com/support/samples/Grid.Windows/7.4.0.15/F91165a.zip
Regards,
Rajadurai
While adding new row through the addnewrow in griddataboundgrid, you can set the hidden column value by handling the RowLeave event through the following code.
if (e.IsAddNew)
{
GridDataBoundGrid grid = sender as GridDataBoundGrid;
CurrencyManager cm = grid.BindingContext[grid.DataSource, grid.DataMember] as CurrencyManager;
int pos = grid.Binder.RowIndexToPosition(e.RowIndex);
DataRowView drv = cm.List[pos] as DataRowView;
drv["Department"] = "MECHANICAL";
}
This event get triggerred before RowSaved event get fired.
Here is the modified sample in which the above mentioned code has been implemented.
http://files.syncfusion.com/support/samples/Grid.Windows/7.4.0.15/F91165a.zip
Regards,
Rajadurai
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
AD Administrator
- Nov 6, 2009 09:09 PM UTC
- Nov 10, 2009 09:25 AM UTC