Hi, I have a data bound grid that is using a custom tablestyle. When the User adds a new record to my grid, I need to display a default date value in one of the cells in the addnew line of the grid. ie the add new row of the grid gets focus and a cell in that row automatically getts filled with a date.
I accomplished this through capturing the Binder.EditModeChanged event. Here''s a small sample, where grid is the databoundgrid and I''m using a typed DataRow to fill in the values. It should get you where you need to go.
// In constructor
this.grid.Binder.EditModeChanged += new EventHandler(Binder_EditModeChanged);
// Event fires this function
public void Binder_EditModeChanged(object sender, System.EventArgs e)
if (this.grid.Binder.IsEditing && this.grid.Binder.IsAddNew )
CurrencyManager cm = (CurrencyManager)this.grid.Binder.BindingContext[this.grid.DataSource, this.grid.DataMember];
if( cm.Position != -1 )
row = (ContingentUsageSchedDataSet.I_CONTINGENT_USG_EDF_DTLRow)((DataRowView)cm.Current).Row;
// RTA Hardcoded per Tom H. email.
row.I_INDUSTRY_SUBSEC_ID = 29;
row.EDF_1_YEAR_ICUED = 0;
row.USG_FRACTION_ICUED = 0;